#990
Brand color
Color field with a swatch, a native picker, a text input and a live WCAG contrast readout against white.
Hand this to your AI. It names the exact library parts, timings and accessibility promises of this demo.
Build the "Brand color" pattern (@codeatlasdev/ui demo #990, inputs/color-field) in my app.
Call get_demo({ ids: ["#990"] }) first and keep its structure. It needs @codeatlasdev/[email protected].
Use: Picking a brand or accent color where contrast matters.
Keep these library parts, with the props and tokens the demo uses:
- ColorField from "@codeatlasdev/ui"
Behaviour to keep:
- `<ColorField` with `label="Brand color"` and `bind:value={brand}`
- `against="#ffffff"`, `role="fill"` and `minRatio={3}` so the readout measures white on the color as a UI part
- Has a `description`: Type #hex, rgb() or oklch(), or pick.
- Initial value is `$state('#2b5fd9')`
- Current value is shown as `value: {brand}`
Reduced motion: the demo handles it; keep that branch.
Keyboard: operable; keep the focus order and key handling.
Change only the copy and the data. Use the theme tokens (--ca-*), never raw colours. Library parts
- ColorField
@codeatlasdev/ui
How it is built
- `<ColorField` with `label="Brand color"` and `bind:value={brand}`
- `against="#ffffff"`, `role="fill"` and `minRatio={3}` so the readout measures white on the color as a UI part
- Has a `description`: Type #hex, rgb() or oklch(), or pick.
- Initial value is `$state('#2b5fd9')`
- Current value is shown as `value: {brand}`
Related
Loading source.