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-function

Color Function

ridiculous/color-function
FreeComponent

Ridiculously typed editor for the modern CSS color functions — color-mix(), light-dark(), and relative color — each with its own compile-time grammar and per-space channel strictness. Reuses color-picker and ships a result-swatch preview.

Install it

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

Source

src/components/ui/color-function/color-function.tsxridiculous.turtlesocks.dev/r/color-function.json
1"use client"
2
3import { useEffect, useRef, useState } from "react"
4import { Button } from "@/components/ui/button"
5import {
6 Popover,
7 PopoverContent,
8 PopoverTrigger,
9} from "@/components/ui/popover"
10import { cn } from "@/lib/utils"
11import {
12 defaultState,
13 formatColorFunction,
14 parseColorFunction,
15} from "./color-function.helpers"
16import type {
17 ColorFunctionMode,
18 ColorFunctionState,
19 ColorFunctionStringMap,
20} from "./color-function.types"
21import { ColorFunctionPreview } from "./color-function-preview"
22import { ColorMixEditor } from "./color-mix-editor"
23import { FamilySelect } from "./family-select"
24import { LightDarkEditor } from "./light-dark-editor"
25import { LiveString } from "./live-string"
26import { RelativeColorEditor } from "./relative-color-editor"
27
28export type { ColorFunctionPreviewProps } from "./color-function-preview"
29// Re-export the public sub-components so consumers (and tests) can import them
30// either from this entry or from the package index — the split is invisible.
31export { ColorFunctionPreview } from "./color-function-preview"
32export type { ColorMixEditorProps } from "./color-mix-editor"
33export { ColorMixEditor } from "./color-mix-editor"
34export type { LightDarkEditorProps } from "./light-dark-editor"
35export { LightDarkEditor } from "./light-dark-editor"
36export type { RelativeColorEditorProps } from "./relative-color-editor"
37export { RelativeColorEditor } from "./relative-color-editor"
38
39// ---------------------------------------------------------------------------
40// Props
41// ---------------------------------------------------------------------------
42
43export interface ColorFunctionPanelProps<
44 TMode extends ColorFunctionMode = "color-mix",
45> {
46 /**
47 * Which family to edit. When omitted, the panel shows a family selector
48 * and edits any of the three at runtime; the `onChange` string type then
49 * defaults to the `color-mix` suggestion shape for typing purposes.
50 */
51 mode?: TMode
52 value: ColorFunctionStringMap[TMode] | (string & {})
53 onChange: (value: ColorFunctionStringMap[TMode]) => void
54 className?: string
55 "aria-label"?: string
56}
57
58export interface ColorFunctionProps<
59 TMode extends ColorFunctionMode = "color-mix",
60> extends ColorFunctionPanelProps<TMode> {}
61
62// ---------------------------------------------------------------------------
63// ColorFunction — popover-wrapped
64// ---------------------------------------------------------------------------
65
66// … truncated

What it pulls in

Other registry items

  • ridiculous-type-kit
  • color-picker
  • button
  • popover
  • input
  • label
  • select
  • slider

Files it writes

  • src/components/ui/color-function/index.ts
  • src/components/ui/color-function/color-function.tsx
  • src/components/ui/color-function/color-function.types.ts
  • src/components/ui/color-function/color-function.helpers.ts
  • src/components/ui/color-function/color-function-preview.tsx
  • src/components/ui/color-function/color-mix-editor.tsx
  • src/components/ui/color-function/family-select.tsx
  • src/components/ui/color-function/light-dark-editor.tsx
  • src/components/ui/color-function/live-string.tsx
  • src/components/ui/color-function/relative-color-editor.tsx

Facts

Registry
ridiculous
Type
registry:ui
Access
Free
Files written
10
Licence
MIT
First indexed
2026-08-02
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 Pickercolor-pickerridiculousComponentsFreeno deps · 11 files
Easing Pickereasing-pickerridiculousComponentsFreeno deps · 17 files
BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex