BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/weekendsuperhero-io/sistine/auto-foreground

Auto Foreground

weekendsuperhero-io-sistine/auto-foreground
UnverifiedComponent

Sets --foreground / --muted-foreground from an OKLCH ramp so text contrast tracks light/dark automatically. Configure declaratively via props (palette, start, ramp) or a persisted config; re-applies on theme change.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/Weekendsuperhero-io/sistine/main/auto-foreground.json

Source

components/auto-foreground.tsxraw.githubusercontent.com/Weekendsuperhero-io/sistine/main/auto-foreground.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import {
5 formatOklch,
6 glassSolidSurface,
7 HARMONIC_OFFSETS,
8 type HarmonicName,
9 harmonicHue,
10 pickInBand,
11 READABLE_USAGE,
12 readableForeground,
13 type ThemeForegroundOptions,
14 themeForeground,
15} from "@/lib/oklch-utils";
16
17const FG_STORAGE_KEY = "sistine-fg";
18const RAMP_KEY = "sistine-ramp";
19const FG_EVENT = "sistine-fg";
20
21// Dev instrumentation: set localStorage["sistine-fg-debug"] = "1" (then reload) to log each update()'s
22// wall-time and how far it nudges --foreground off the CSS baseline (the "marginal bump"). Off by default.
23const fgDebug = () => {
24 try {
25 return typeof localStorage !== "undefined" && localStorage.getItem("sistine-fg-debug") === "1";
26 } catch {
27 return false;
28 }
29};
30
31export type FgPalette = ThemeForegroundOptions["palette"];
32export interface FgConfig {
33 palette: FgPalette;
34 /** Icon foreground hue for `--foreground-ui`: a number (0–360) pins a hue; a harmonic name
35 * ("complement" | "triad-1" | "split-2" | … — a color-wheel relationship rotated off --harmony-h,
36 * tracked live); null → icons follow the theme/text color. Always contrast-solved (APCA/ARC). */
37 iconHue: number | HarmonicName | null;
38 /** Heading/large-text hue for `--foreground-soft` — same semantics as iconHue (number pins, a harmonic
39 * name rotates off the theme live, null → follow the chosen palette ramp). */
40 softHue: number | HarmonicName | null;
41 /** Fine/small-text hue for `--foreground-strong` — same semantics (null → follow the palette ramp). */
42 strongHue: number | HarmonicName | null;
43}
44/** The /colors ramp generator's base color + step count, shared with the foreground. */
45export interface RampConfig {
46 l: number;
47 c: number;
48 h: number;
49 count: number;
50}
51
52const FG_PALETTES: FgPalette[] = [
53 "tonal",
54 "lightness",
55 "hue",
56 "chroma",
57];
58const DEFAULT_FG: FgConfig = {
59 palette: "lightness", // linear ramp — holds the theme's chroma, so high-contrast text reads as a soft tinted white, not gray
60 iconHue: null,
61 softHue: null,
62 strongHue: null,
63};
64const DEFAULT_RAMP: RampConfig = {
65 l: 60,
66 c: 0.15,
67 h: 255,
68 count: 12, // finest ramp (12 steps/side) — the most cohesive foreground set in practice
69};
70
71/** Normalize a stored hue choice: a harmonic relationship name, a pinned number, else null. */
72const hueChoice = (v: unknown): number | HarmonicName | null =>
73// … truncated

What it pulls in

Other registry items

  • @sistine/oklch-utils
  • @sistine/theme

Files it writes

  • components/auto-foreground.tsx

Facts

Registry
weekendsuperhero-io/sistine
Type
registry:component
Access
Unverified
Files written
1
Licence
MIT
In the index
at or before 2026-08-13
Last confirmed
2 days ago

Go to the source

weekendsuperhero.io Weekendsuperhero-io/sistine on GitHub Raw registry item This item as JSON

More from weekendsuperhero-io/sistine

All 71 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionweekendsuperhero-io/sistineComponentsUnverified5 deps · 4 files
Alertalertweekendsuperhero-io/sistineComponentsUnverified3 deps · 4 files
Alert Dialogalert-dialogweekendsuperhero-io/sistineComponentsUnverified4 deps · 4 files
Avataravatarweekendsuperhero-io/sistineComponentsUnverified4 deps · 4 files
Badgebadgeweekendsuperhero-io/sistineComponentsUnverified4 deps · 4 files
Breadcrumbbreadcrumbweekendsuperhero-io/sistineComponentsUnverified5 deps · 4 files
Buttonbuttonweekendsuperhero-io/sistineComponentsUnverified4 deps · 4 files
Button Groupbutton-groupweekendsuperhero-io/sistineComponentsUnverified4 deps · 4 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