Primitive · CLI
Adaptive Theme Switch
Preview
npx shadcn@latest add @atroui/theme-adaptPalettes
Light
2.7:1 fail
Studio notes
Cone 6 this Thursday
Hold at peak twenty minutes. The glaze notes sit in muted type. Lose those and the firing is guesswork.
Open scheduleNaive dark
1.6:1 fail
Studio notes
Cone 6 this Thursday
Hold at peak twenty minutes. The glaze notes sit in muted type. Lose those and the firing is guesswork.
Open scheduleAdapt
7.7:1 AA
Studio notes
Cone 6 this Thursday
Hold at peak twenty minutes. The glaze notes sit in muted type. Lose those and the firing is guesswork.
Open scheduleInstallation
Agent blurb — install command + no npm UI rule. For agents
npx shadcn@latest add @atroui/theme-adaptSource lands in your repo. Installation · Registry
Usage
import { ThemeAdapt } from "@/components/ui/theme-adapt"
<ThemeAdapt />API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | - | Extra classes on the control stack. |
| adapt | boolean | true | When true, night mode applies a generated companion from light tokens. |
| minContrast | number | 4.5 | WCAG contrast target for body and muted text. |
DAY/NIGHT samples your light :root tokens, builds an OKLCH companion (same hue, darker canvas, type to AA), and writes it onto the page. The three columns still show Light / Naive crush / Adapt for Kiln, Uptime, Dusk, and Edition. shadcn/ui ships a class toggle and two token sheets you write by hand — not a runtime companion from light tokens.
Derive night UI from the light tokens you already have
shadcn ships :root and .dark as two sheets you maintain. Adaptive Theme Switch reads computed light colors and emits a companion palette (AA muted type). It is not a full theme engine — hover, sidebar, and images stay on you.
FAQ1
- Does it replace next-themes?
- No. Pair with ThemeProvider. Site chrome on atroui.com still uses the classic toggle until you opt the header into ThemeAdapt.
Adaptive Theme Switch