BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/ridiculous/color-picker

Color Picker

ridiculous/color-picker
FreeComponent

Ridiculously typed color picker with oklch L×C pad, hue/alpha strips, and 6-mode round-trip (oklch, oklab, hex, rgb, hsl, hwb).

Install it

npx shadcn@latest add http://ridiculous.turtlesocks.dev/r/color-picker.json

Source

src/components/ui/color-picker/color-picker.tsxridiculous.turtlesocks.dev/r/color-picker.json · first 6 KB
1"use client"
2
3import { useEffect, useRef, useState } from "react"
4import {
5 Popover,
6 PopoverContent,
7 PopoverTrigger,
8} from "@/components/ui/popover"
9import { cn } from "@/lib/utils"
10import { AlphaStrip } from "./alpha-strip"
11import { MAX_RECENTS, PRESETS } from "./color-picker.constants"
12import {
13 formatColor,
14 formatHex,
15 parseColor,
16 parseHex,
17 pushRecent,
18 resolveCssColor,
19 srgbToOklch,
20} from "./color-picker.helpers"
21import { useControllableState } from "./color-picker.hooks"
22import type {
23 ColorMode,
24 ColorString,
25 ColorValue,
26 Oklch,
27} from "./color-picker.types"
28import { HueStrip } from "./hue-strip"
29import { LcPad } from "./lc-pad"
30import { ModeButtonGroup } from "./mode-button-group"
31import { type SwatchEntry, SwatchRow } from "./swatch-row"
32
33export interface ColorPickerProps<
34 TMode extends ColorMode | undefined = undefined,
35> {
36 value: ColorString | (string & {})
37 onChange: (value: ColorValue<TMode>) => void
38 mode?: TMode
39 native?: boolean
40 className?: string
41 "aria-label"?: string
42 /**
43 * Preset swatches. Each entry is a color value OR a CSS variable
44 * (`"var(--color-primary)"` or bare `"--color-primary"`). `undefined` →
45 * the built-in palette; `[]` → no preset row. NOTE: this project's Tailwind
46 * v4 theme tokens are `--color-*`; pass the full name. A CSS-var entry must
47 * resolve to an sRGB-representable color (wide-gamut P3 tokens are skipped).
48 */
49 presets?: ReadonlyArray<ColorString | (string & {})>
50 /** Controlled recents. When provided, the component does not own this state. */
51 history?: ReadonlyArray<ColorValue<TMode>>
52 /** Uncontrolled initial recents. Ignored when `history` is provided. */
53 defaultHistory?: ReadonlyArray<ColorValue<TMode>>
54 /**
55 * Fired when recents change (a color committed on popover close). Fires in
56 * both modes. Passing `history` without `onHistoryChange` yields a frozen,
57 * read-only recents row.
58 */
59 onHistoryChange?: (history: ColorValue<TMode>[]) => void
60}
61
62export function ColorPicker<TMode extends ColorMode | undefined>({
63 value,
64 onChange,
65 mode: modeProp,
66 native = false,
67 className,
68 "aria-label": ariaLabel = "Pick a color",
69 presets,
70 history,
71 defaultHistory,
72 onHistoryChange,
73}: ColorPickerProps<TMode>) {
74 const parsedFromValue = parseColor(value)
75
76 // Internal canonical oklch is the source of truth for the L×C pad / sliders.
77 // We do NOT derive marker position from each re-parse of `value`, because
78// … truncated

What it pulls in

Other registry items

  • button
  • popover

Files it writes

  • src/components/ui/color-picker/index.ts
  • src/components/ui/color-picker/color-picker.tsx
  • src/components/ui/color-picker/color-picker.helpers.ts
  • src/components/ui/color-picker/color-picker.types.ts
  • src/components/ui/color-picker/color-picker.hooks.ts
  • src/components/ui/color-picker/alpha-strip.tsx
  • src/components/ui/color-picker/color-picker.constants.ts
  • src/components/ui/color-picker/hue-strip.tsx
  • src/components/ui/color-picker/lc-pad.tsx
  • src/components/ui/color-picker/mode-button-group.tsx
  • src/components/ui/color-picker/swatch-row.tsx

Facts

Registry
ridiculous
Type
registry:ui
Access
Free
Files written
11
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
today

Go to the source

ridiculous.turtlesocks.dev TurtIeSocks/ridiculous on GitHub Raw registry item This item as JSON

More from ridiculous

All 22 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
All ridiculous componentsallridiculousComponentsFreeno deps
Anchor Position Editoranchor-position-editorridiculousComponentsFreeno deps · 9 files
Background Editorbackground-editorridiculousComponentsFreeno deps · 9 files
Box Shadow Editorbox-shadow-editorridiculousComponentsFreeno deps · 7 files
Calc Editorcalc-editorridiculousComponentsFreeno deps · 4 files
Clip Path Editorclip-path-editorridiculousComponentsFreeno deps · 20 files
Color Functioncolor-functionridiculousComponentsFreeno deps · 10 files
Easing Pickereasing-pickerridiculousComponentsFreeno deps · 17 files

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex