{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "input-color-picker",
  "type": "registry:component",
  "title": "Color Picker",
  "description": "A color picker with a saturation and brightness pad, hue and opacity sliders, a HEX, RGB and HSL field and swatches. It shows the original next to the new color and grades contrast against your background with WCAG AA and AAA.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "forms",
    "color",
    "picker",
    "hex",
    "contrast",
    "wcag",
    "design-tools"
  ],
  "docs": "https://hyperblur.dev/effects/input-color-picker",
  "files": [
    {
      "path": "registry/hyperblur/input-color-picker.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/input-color-picker.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface InputColorPickerProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n  label?: string;\n  value?: string;\n  defaultValue?: string;\n  onChange?: (hex: string) => void;\n  swatches?: string[];\n  alpha?: boolean;\n  contrastWith?: string;\n}\n\ntype Hsv = { h: number; s: number; v: number; a: number };\ntype Rgb = { r: number; g: number; b: number };\n\nconst css = `\n.hb-xg8 {\n  box-sizing: border-box;\n  width: 100%;\n  font-family: inherit;\n  color: #ededed;\n  container-type: inline-size;\n}\n.hb-xg8 *, .hb-xg8 *::before, .hb-xg8 *::after { box-sizing: border-box; }\n.hb-xg8-label { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; font-size: 12.5px; font-weight: 500; color: #a1a1a1; }\n.hb-xg8-grid { display: grid; gap: 10px; }\n@container (min-width: 300px) { .hb-xg8-grid { grid-template-columns: minmax(120px, 46%) minmax(0, 1fr); } }\n.hb-xg8-sv {\n  position: relative;\n  min-height: 120px;\n  aspect-ratio: 4 / 3;\n  border-radius: 12px;\n  background:\n    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),\n    linear-gradient(to right, #fff, rgba(255, 255, 255, 0)),\n    hsl(var(--hb-xg8-h), 100%, 50%);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 8px 20px -12px rgba(0, 0, 0, 0.9);\n  cursor: crosshair;\n  touch-action: none;\n  outline: 0;\n}\n@container (min-width: 300px) { .hb-xg8-sv { aspect-ratio: auto; height: 100%; } }\n.hb-xg8-sv:focus-visible { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 0 2px #0a0a0a, 0 0 0 4px #ededed; }\n.hb-xg8-thumb {\n  position: absolute;\n  width: 18px;\n  height: 18px;\n  margin: -9px 0 0 -9px;\n  border: 2.5px solid #fff;\n  border-radius: 50%;\n  background: var(--hb-xg8-solid);\n  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.45);\n  pointer-events: none;\n  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-xg8[data-drag=\"sv\"] .hb-xg8-sv .hb-xg8-thumb { transform: scale(1.35); }\n.hb-xg8-side { display: flex; flex-direction: column; gap: 9px; min-width: 0; }\n.hb-xg8-row { display: flex; align-items: center; gap: 8px; }\n.hb-xg8-swatch {\n  position: relative;\n  width: 34px;\n  height: 34px;\n  flex: none;\n  border-radius: 10px;\n  overflow: hidden;\n  background: repeating-conic-gradient(#2a2a2a 0 25%, #1a1a1a 0 50%) 0 0 / 8px 8px;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);\n}\n.hb-xg8-swatch span { position: absolute; top: 0; bottom: 0; }\n.hb-xg8-swatch span:first-child { left: 0; width: 50%; }\n.hb-xg8-swatch span:last-child { right: 0; width: 50%; transition: background 0.12s ease; }\n.hb-xg8-sliders { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; }\n.hb-xg8-track {\n  position: relative;\n  height: 12px;\n  border-radius: 999px;\n  cursor: pointer;\n  touch-action: none;\n  outline: 0;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);\n}\n.hb-xg8-track:focus-visible { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 0 2px #0a0a0a, 0 0 0 3.5px #ededed; }\n.hb-xg8-hue { background: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00); }\n.hb-xg8-alpha { background: linear-gradient(90deg, transparent, var(--hb-xg8-solid)), repeating-conic-gradient(#2a2a2a 0 25%, #1a1a1a 0 50%) 0 0 / 8px 8px; }\n.hb-xg8-track .hb-xg8-thumb { top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-width: 2.5px; }\n.hb-xg8-hue .hb-xg8-thumb { background: hsl(var(--hb-xg8-h), 100%, 50%); }\n.hb-xg8[data-drag=\"hue\"] .hb-xg8-hue .hb-xg8-thumb, .hb-xg8[data-drag=\"alpha\"] .hb-xg8-alpha .hb-xg8-thumb { transform: scale(1.3); }\n.hb-xg8-field {\n  display: flex;\n  align-items: center;\n  height: 32px;\n  border: 1px solid #262626;\n  border-radius: 9px;\n  background: #0f0f0f;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);\n  overflow: hidden;\n  transition: border-color 0.2s ease;\n}\n.hb-xg8-field:focus-within { border-color: #4a4a4a; }\n.hb-xg8-fmt {\n  height: 100%;\n  margin: 0;\n  padding: 0 8px;\n  border: 0;\n  border-right: 1px solid #222;\n  background: #151515;\n  color: #8f8f8f;\n  font: inherit;\n  font-size: 10.5px;\n  font-weight: 600;\n  letter-spacing: 0.05em;\n  cursor: pointer;\n}\n.hb-xg8-fmt:hover { color: #ededed; }\n.hb-xg8-fmt:focus-visible { outline: 2px solid #ededed; outline-offset: -2px; }\n.hb-xg8-in {\n  flex: 1;\n  min-width: 0;\n  height: 100%;\n  margin: 0;\n  padding: 0 8px;\n  border: 0;\n  outline: 0;\n  background: transparent;\n  color: #ededed;\n  font-family: var(--font-mono), ui-monospace, monospace;\n  font-size: 12px;\n}\n.hb-xg8-in[aria-invalid=\"true\"] { color: #ff7a7a; }\n.hb-xg8-drop {\n  display: grid;\n  place-items: center;\n  width: 32px;\n  height: 100%;\n  flex: none;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-left: 1px solid #222;\n  background: transparent;\n  color: #8f8f8f;\n  cursor: pointer;\n}\n.hb-xg8-drop:hover { color: #ededed; background: rgba(255, 255, 255, 0.04); }\n.hb-xg8-drop:focus-visible { outline: 2px solid #ededed; outline-offset: -2px; }\n.hb-xg8-drop svg { width: 14px; height: 14px; }\n.hb-xg8-sw { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }\n.hb-xg8-chip {\n  position: relative;\n  width: 20px;\n  height: 20px;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 6px;\n  background: var(--hb-xg8-sw);\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);\n  cursor: pointer;\n  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);\n}\n.hb-xg8-chip:hover { transform: translateY(-2px) scale(1.08); }\n.hb-xg8-chip:focus-visible { outline: 2px solid #ededed; outline-offset: 2px; }\n.hb-xg8-chip[aria-pressed=\"true\"]::after { content: \"\"; position: absolute; inset: -3px; border-radius: 8px; box-shadow: 0 0 0 1.5px #ededed; }\n.hb-xg8-cx {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  height: 30px;\n  padding: 0 4px 0 6px;\n  border-radius: 9px;\n  background: #121212;\n  box-shadow: inset 0 0 0 1px #222;\n  font-size: 11.5px;\n  color: #a1a1a1;\n  font-variant-numeric: tabular-nums;\n}\n.hb-xg8-aa {\n  display: grid;\n  place-items: center;\n  width: 30px;\n  height: 22px;\n  flex: none;\n  border-radius: 6px;\n  background: var(--hb-xg8-bg);\n  color: var(--hb-xg8-solid);\n  font-size: 12px;\n  font-weight: 700;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);\n}\n.hb-xg8-cx b { flex: 1; font-weight: 600; color: #ededed; }\n.hb-xg8-badge { padding: 2px 6px; border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }\n.hb-xg8-badge[data-ok=\"true\"] { background: rgba(63, 191, 127, 0.16); color: #5fd38d; }\n.hb-xg8-badge[data-ok=\"false\"] { background: rgba(255, 92, 92, 0.14); color: #ff7a7a; }\n.hb-xg8-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xg8 * { transition: none !important; animation: none !important; }\n}\n`;\n\nconst clamp = (n: number, a = 0, b = 1) => Math.min(b, Math.max(a, n));\n\nfunction hsvToRgb({ h, s, v }: Hsv): Rgb {\n  const f = (n: number) => {\n    const k = (n + h / 60) % 6;\n    return v - v * s * Math.max(0, Math.min(k, 4 - k, 1));\n  };\n  return { r: Math.round(f(5) * 255), g: Math.round(f(3) * 255), b: Math.round(f(1) * 255) };\n}\n\nfunction rgbToHsv({ r, g, b }: Rgb, a = 1, keepHue = 0): Hsv {\n  const R = r / 255;\n  const G = g / 255;\n  const B = b / 255;\n  const max = Math.max(R, G, B);\n  const min = Math.min(R, G, B);\n  const d = max - min;\n  let h = keepHue;\n  if (d) {\n    if (max === R) h = 60 * (((G - B) / d) % 6);\n    else if (max === G) h = 60 * ((B - R) / d + 2);\n    else h = 60 * ((R - G) / d + 4);\n  }\n  return { h: (h + 360) % 360, s: max ? d / max : 0, v: max, a };\n}\n\nfunction hex2(n: number) {\n  return Math.round(n).toString(16).padStart(2, \"0\");\n}\n\nfunction toHex(c: Hsv, withAlpha: boolean) {\n  const { r, g, b } = hsvToRgb(c);\n  return `#${hex2(r)}${hex2(g)}${hex2(b)}${withAlpha && c.a < 1 ? hex2(c.a * 255) : \"\"}`;\n}\n\nfunction rgbToHsl({ r, g, b }: Rgb) {\n  const R = r / 255;\n  const G = g / 255;\n  const B = b / 255;\n  const max = Math.max(R, G, B);\n  const min = Math.min(R, G, B);\n  const l = (max + min) / 2;\n  const d = max - min;\n  const s = d ? d / (1 - Math.abs(2 * l - 1)) : 0;\n  const h = rgbToHsv({ r, g, b }).h;\n  return { h: Math.round(h), s: Math.round(s * 100), l: Math.round(l * 100) };\n}\n\nfunction parseColor(input: string, keepHue: number): Hsv | null {\n  const t = input.trim().toLowerCase();\n  const hx = /^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.exec(t);\n  if (hx) {\n    let h = hx[1];\n    if (h.length <= 4) h = h.split(\"\").map((c) => c + c).join(\"\");\n    const n = (i: number) => parseInt(h.slice(i, i + 2), 16);\n    return rgbToHsv({ r: n(0), g: n(2), b: n(4) }, h.length === 8 ? n(6) / 255 : 1, keepHue);\n  }\n  const rgb = /^rgba?\\(\\s*(\\d{1,3})[\\s,]+(\\d{1,3})[\\s,]+(\\d{1,3})(?:[\\s,/]+([\\d.]+%?))?\\s*\\)$/.exec(t);\n  if (rgb) {\n    const a = rgb[4] ? (rgb[4].endsWith(\"%\") ? parseFloat(rgb[4]) / 100 : parseFloat(rgb[4])) : 1;\n    return rgbToHsv({ r: clamp(+rgb[1], 0, 255), g: clamp(+rgb[2], 0, 255), b: clamp(+rgb[3], 0, 255) }, clamp(a), keepHue);\n  }\n  const hsl = /^hsla?\\(\\s*([\\d.]+)(?:deg)?[\\s,]+([\\d.]+)%[\\s,]+([\\d.]+)%(?:[\\s,/]+([\\d.]+%?))?\\s*\\)$/.exec(t);\n  if (hsl) {\n    const h = +hsl[1] % 360;\n    const s = clamp(+hsl[2] / 100);\n    const l = clamp(+hsl[3] / 100);\n    const v = l + s * Math.min(l, 1 - l);\n    const a = hsl[4] ? (hsl[4].endsWith(\"%\") ? parseFloat(hsl[4]) / 100 : parseFloat(hsl[4])) : 1;\n    return { h, s: v ? 2 * (1 - l / v) : 0, v, a: clamp(a) };\n  }\n  return null;\n}\n\nfunction luminance({ r, g, b }: Rgb) {\n  const f = (c: number) => {\n    const x = c / 255;\n    return x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n  };\n  return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b);\n}\n\nfunction contrast(a: Rgb, b: Rgb) {\n  const x = luminance(a);\n  const y = luminance(b);\n  return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);\n}\n\nfunction subscribeNone() {\n  return () => {};\n}\n\nfunction hasDropper() {\n  return \"EyeDropper\" in window;\n}\n\nfunction noDropper() {\n  return false;\n}\n\nconst formats = [\"HEX\", \"RGB\", \"HSL\"] as const;\n\nexport function InputColorPicker({\n  label = \"Brand color\",\n  value,\n  defaultValue = \"#2f7bff\",\n  onChange,\n  swatches = [\"#2f7bff\", \"#7c5cff\", \"#ff4d8d\", \"#ff8a3d\", \"#f5c542\", \"#3fbf7f\", \"#14b8c4\", \"#ededed\"],\n  alpha = true,\n  contrastWith = \"#0a0a0a\",\n  className = \"\",\n  style,\n  ...rest\n}: InputColorPickerProps) {\n  const id = React.useId();\n  const [inner, setInner] = React.useState<Hsv>(() => parseColor(defaultValue, 0) ?? { h: 217, s: 0.8, v: 1, a: 1 });\n  const controlled = value !== undefined;\n  const fromValue = controlled ? parseColor(value, inner.h) : null;\n  const color: Hsv = fromValue && toHex(fromValue, alpha) !== toHex(inner, alpha) ? fromValue : inner;\n  const [fmt, setFmt] = React.useState<(typeof formats)[number]>(\"HEX\");\n  const [draft, setDraft] = React.useState<string | null>(null);\n  const [drag, setDrag] = React.useState<\"sv\" | \"hue\" | \"alpha\" | null>(null);\n  const [initial] = React.useState(() => toHex(parseColor(value ?? defaultValue, 0) ?? inner, alpha));\n  const dropper = React.useSyncExternalStore(subscribeNone, hasDropper, noDropper);\n\n  const rgb = hsvToRgb(color);\n  const hex = toHex(color, alpha);\n  const solid = `rgb(${rgb.r}, ${rgb.g}, ${rgb.b})`;\n  const shown =\n    fmt === \"HEX\"\n      ? hex.toUpperCase()\n      : fmt === \"RGB\"\n        ? `rgb(${rgb.r} ${rgb.g} ${rgb.b}${alpha && color.a < 1 ? ` / ${Math.round(color.a * 100)}%` : \"\"})`\n        : (() => {\n            const l = rgbToHsl(rgb);\n            return `hsl(${l.h} ${l.s}% ${l.l}%${alpha && color.a < 1 ? ` / ${Math.round(color.a * 100)}%` : \"\"})`;\n          })();\n  const bg = parseColor(contrastWith, 0);\n  const bgRgb = bg ? hsvToRgb(bg) : { r: 10, g: 10, b: 10 };\n  const ratio = contrast(rgb, bgRgb);\n  const grade = ratio >= 7 ? \"AAA\" : ratio >= 4.5 ? \"AA\" : ratio >= 3 ? \"AA Large\" : \"Fail\";\n\n  function commit(next: Hsv) {\n    setInner(next);\n    onChange?.(toHex(next, alpha));\n  }\n\n  function fromPointer(kind: \"sv\" | \"hue\" | \"alpha\", e: React.PointerEvent<HTMLDivElement>) {\n    const r = e.currentTarget.getBoundingClientRect();\n    const x = clamp((e.clientX - r.left) / r.width);\n    const y = clamp((e.clientY - r.top) / r.height);\n    if (kind === \"sv\") commit({ ...color, s: x, v: 1 - y });\n    else if (kind === \"hue\") commit({ ...color, h: x * 359.9 });\n    else commit({ ...color, a: Math.round(x * 100) / 100 });\n  }\n\n  function pointer(kind: \"sv\" | \"hue\" | \"alpha\") {\n    return {\n      onPointerDown: (e: React.PointerEvent<HTMLDivElement>) => {\n        if (e.button !== 0) return;\n        e.currentTarget.setPointerCapture(e.pointerId);\n        e.currentTarget.focus();\n        setDrag(kind);\n        fromPointer(kind, e);\n      },\n      onPointerMove: (e: React.PointerEvent<HTMLDivElement>) => {\n        if (drag === kind) fromPointer(kind, e);\n      },\n      onPointerUp: () => setDrag(null),\n      onPointerCancel: () => setDrag(null),\n    };\n  }\n\n  function keys(kind: \"sv\" | \"hue\" | \"alpha\") {\n    return (e: React.KeyboardEvent) => {\n      const big = e.shiftKey ? 10 : 1;\n      const dx = e.key === \"ArrowRight\" ? 1 : e.key === \"ArrowLeft\" ? -1 : 0;\n      const dy = e.key === \"ArrowUp\" ? 1 : e.key === \"ArrowDown\" ? -1 : 0;\n      if (!dx && !dy) return;\n      e.preventDefault();\n      if (kind === \"sv\") commit({ ...color, s: clamp(color.s + (dx * big) / 100), v: clamp(color.v + (dy * big) / 100) });\n      else if (kind === \"hue\") commit({ ...color, h: (color.h + (dx || dy) * big + 360) % 360 });\n      else commit({ ...color, a: clamp(Math.round((color.a + ((dx || dy) * big) / 100) * 100) / 100) });\n    };\n  }\n\n  function applyDraft() {\n    if (draft === null) return;\n    const p = parseColor(draft, color.h);\n    if (p) commit(alpha ? p : { ...p, a: 1 });\n    setDraft(null);\n  }\n\n  async function pick() {\n    const Ctor = (window as unknown as { EyeDropper?: new () => { open: () => Promise<{ sRGBHex: string }> } }).EyeDropper;\n    if (!Ctor) return;\n    try {\n      const res = await new Ctor().open();\n      const p = parseColor(res.sRGBHex, color.h);\n      if (p) commit({ ...p, a: color.a });\n    } catch {\n      return;\n    }\n  }\n\n  const draftBad = draft !== null && parseColor(draft, 0) === null;\n  const vars = {\n    \"--hb-xg8-h\": color.h.toFixed(1),\n    \"--hb-xg8-solid\": solid,\n    \"--hb-xg8-bg\": contrastWith,\n    ...style,\n  } as React.CSSProperties;\n\n  return (\n    <div className={`hb-xg8 ${className}`} style={vars} data-drag={drag ?? \"none\"} {...rest}>\n      <style href=\"hb-input-color-picker\" precedence=\"default\">{css}</style>\n      {label && (\n        <div className=\"hb-xg8-label\">\n          <span id={`${id}-l`}>{label}</span>\n        </div>\n      )}\n      <div className=\"hb-xg8-grid\" role=\"group\" aria-labelledby={label ? `${id}-l` : undefined}>\n        <div\n          className=\"hb-xg8-sv\"\n          role=\"slider\"\n          tabIndex={0}\n          aria-label=\"Saturation and brightness\"\n          aria-valuetext={`Saturation ${Math.round(color.s * 100)}%, brightness ${Math.round(color.v * 100)}%`}\n          aria-valuenow={Math.round(color.s * 100)}\n          aria-valuemin={0}\n          aria-valuemax={100}\n          onKeyDown={keys(\"sv\")}\n          {...pointer(\"sv\")}\n        >\n          <span className=\"hb-xg8-thumb\" style={{ left: `${(color.s * 100).toFixed(2)}%`, top: `${((1 - color.v) * 100).toFixed(2)}%` }} />\n        </div>\n        <div className=\"hb-xg8-side\">\n          <div className=\"hb-xg8-row\">\n            <span className=\"hb-xg8-swatch\" aria-hidden=\"true\">\n              <span style={{ background: initial }} />\n              <span style={{ background: hex }} />\n            </span>\n            <div className=\"hb-xg8-sliders\">\n              <div\n                      className=\"hb-xg8-track hb-xg8-hue\"\n                role=\"slider\"\n                tabIndex={0}\n                aria-label=\"Hue\"\n                aria-valuemin={0}\n                aria-valuemax={360}\n                aria-valuenow={Math.round(color.h)}\n                onKeyDown={keys(\"hue\")}\n                {...pointer(\"hue\")}\n              >\n                <span className=\"hb-xg8-thumb\" style={{ left: `${((color.h / 360) * 100).toFixed(2)}%` }} />\n              </div>\n              {alpha && (\n                <div\n                          className=\"hb-xg8-track hb-xg8-alpha\"\n                  role=\"slider\"\n                  tabIndex={0}\n                  aria-label=\"Opacity\"\n                  aria-valuemin={0}\n                  aria-valuemax={100}\n                  aria-valuenow={Math.round(color.a * 100)}\n                  aria-valuetext={`${Math.round(color.a * 100)}%`}\n                  onKeyDown={keys(\"alpha\")}\n                  {...pointer(\"alpha\")}\n                >\n                  <span className=\"hb-xg8-thumb\" style={{ left: `${(color.a * 100).toFixed(2)}%`, background: hex }} />\n                </div>\n              )}\n            </div>\n          </div>\n          <div className=\"hb-xg8-field\">\n            <button\n              type=\"button\"\n              className=\"hb-xg8-fmt\"\n              aria-label={`Format ${fmt}, switch format`}\n              onClick={() => {\n                setFmt(formats[(formats.indexOf(fmt) + 1) % formats.length]);\n                setDraft(null);\n              }}\n            >\n              {fmt}\n            </button>\n            <input\n              className=\"hb-xg8-in\"\n              aria-label=\"Color value\"\n              spellCheck={false}\n              value={draft ?? shown}\n              aria-invalid={draftBad}\n              onChange={(e) => setDraft(e.target.value)}\n              onBlur={applyDraft}\n              onKeyDown={(e) => {\n                if (e.key === \"Enter\") applyDraft();\n                if (e.key === \"Escape\") setDraft(null);\n              }}\n            />\n            {dropper && (\n              <button type=\"button\" className=\"hb-xg8-drop\" aria-label=\"Pick a color from the screen\" onClick={pick}>\n                <svg viewBox=\"0 0 14 14\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  <path d=\"M8.2 3.4l2.4 2.4M9.6 2a1.7 1.7 0 0 1 2.4 2.4l-1.3 1.3-2.4-2.4zM8.3 4.7L2.8 10.2 2 12l1.8-.8 5.5-5.5\" />\n                </svg>\n              </button>\n            )}\n          </div>\n          <ul className=\"hb-xg8-sw\" aria-label=\"Swatches\">\n            {swatches.map((s) => (\n              <li key={s}>\n                <button\n                  type=\"button\"\n                  className=\"hb-xg8-chip\"\n                  style={{ \"--hb-xg8-sw\": s } as React.CSSProperties}\n                  aria-label={`Use ${s}`}\n                  aria-pressed={toHex(color, false) === toHex(parseColor(s, 0) ?? color, false)}\n                  onClick={() => {\n                    const p = parseColor(s, color.h);\n                    if (p) commit({ ...p, a: color.a });\n                  }}\n                />\n              </li>\n            ))}\n          </ul>\n          <div className=\"hb-xg8-cx\" aria-live=\"polite\">\n            <span className=\"hb-xg8-aa\" aria-hidden=\"true\">\n              Aa\n            </span>\n            <b>{ratio.toFixed(2)}:1</b>\n            <span className=\"hb-xg8-badge\" data-ok={ratio >= 4.5}>\n              {grade}\n            </span>\n          </div>\n        </div>\n      </div>\n      <span className=\"hb-xg8-sr\" aria-live=\"polite\">\n        {hex}\n      </span>\n    </div>\n  );\n}\n"
    }
  ]
}