fma-ui

Color Picker

An OKLCH color picker: lightness, chroma and hue sliders painted with the color's own gradients. Given a background (contrastWith), it shows the WCAG ratio, hatches the lightness that fails AA, marks the AA/AAA thresholds and offers "Fix to AA/AAA" buttons that jump to the nearest passing lightness keeping the hue. A grid of preset swatches (Tailwind's palette by default, or your own via swatches) sets the color in one click, hatching the presets that fail AA. ColorPicker is a swatch that opens it in a popover; ColorPickerPanel renders it inline.

FormsoriginalRegistry JSON

Installation

  1. 1

    Register the @fma-ui namespace in components.json (once)

    components.json
    {
      "registries": {
        "@fma-ui": "https://ui.fmartinsandre.dev.br/r/{name}.json"
      }
    }
  2. 2

    Add the item

    pnpm dlx shadcn@latest add @fma-ui/color-picker

    Files land in components/fma-ui/color-picker.tsx; npm and registry dependencies are installed along with them.

Dependencies

npm
cn@^0.4.0culori@^4.0.2lucide-react@^1.52.0react-aria-components@^1.21.1
Registry
@fma-ui/button@fma-ui/popover@fma-ui/color-contrast