Skip to content
txbrendan/ui

Icon Color Picker

beta

Choose an artwork color with a native picker or hex field, with validation and a reset.

Preview

Icon color

Follows the original color.

Original color

Follows the original color.

Install

  1. 1. Add the registry to components.json, once per app. Without it, the shadcn CLI looks up @txbrendan in a public list that txbrendan/ui does not control.

    npx shadcn@latest registry add "@txbrendan=https://txbrendan.dev/r/{name}.json"
  2. 2. Add the theme, once per app. It replaces your color tokens with ones checked for contrast.

    npx shadcn@latest add @txbrendan/theme
  3. 3. Add the component.

    npx shadcn@latest add @txbrendan/icon-color-picker

Use it for

  • Controlled color editing for icon artwork. Use null to retain the original color.
  • Accepts three- or six-digit hex. Invalid input preserves the last valid value.

Avoid it for

  • Replacing the interface theme. Use theme tokens for controls and text.

Props

  • original

    Original hex used for the default swatch and placeholder.

    string

  • value

    Chosen hex color, or null for the original.

    string | null

  • onValueChange

    Called for valid colors and resets.

    (value: string | null) => void

  • label

    Visible label and accessible name.

    string · default "Icon color"

  • resetLabel

    Reset action label.

    string · default "Use default color"

  • disabled

    Disables editing.

    boolean · default false

Accessibility

  • Both inputs are labeled. Invalid hex has an associated message and aria-invalid.
  • Chosen artwork colors are not contrast-checked. Controls retain theme colors.

Examples

Controlled artwork

<IconColorPickerExample />