Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .tegami/react-workshop-themes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
packages:
"@domainkit/react": minor
---

## Add host theme presets

Add seven theme presets and token-complete workshop coverage for light and dark host integrations.
281 changes: 281 additions & 0 deletions packages/react/examples/vite/src/workshop-themes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
import type { Theme } from "../../../src/theme.ts";

export const workshopThemePresets = [
{
id: "neutral",
inspiration: "DomainKit baseline",
label: "Neutral",
themes: {
dark: {
accent: "#0070f3",
accentContrast: "#ffffff",
backdrop: "rgb(0 0 0 / 0.62)",
background: "#18181b",
border: "#3f3f46",
danger: "#f87171",
dangerContrast: "#18181b",
fill: "#27272a",
muted: "#a1a1aa",
radius: "0.75rem",
shadow: "0 16px 40px rgb(0 0 0 / 0.4)",
success: "#34d399",
text: "#fafafa",
},
light: {
accent: "#0070f3",
accentContrast: "#ffffff",
backdrop: "rgb(15 23 42 / 0.45)",
background: "#ffffff",
border: "#d4d4d8",
danger: "#dc2626",
dangerContrast: "#ffffff",
fill: "#f4f4f5",
muted: "#52525b",
radius: "0.75rem",
shadow: "0 16px 40px rgb(15 23 42 / 0.12)",
success: "#059669",
text: "#18181b",
},
},
},
{
id: "monochrome",
inspiration: "Vercel",
label: "Monochrome",
themes: {
dark: {
accent: "#ededed",
accentContrast: "#0a0a0a",
backdrop: "rgb(0 0 0 / 0.72)",
background: "#0a0a0a",
border: "#333333",
danger: "#ff6166",
dangerContrast: "#0a0a0a",
fill: "#1a1a1a",
muted: "#a1a1a1",
radius: "0.5rem",
shadow: "0 16px 40px rgb(0 0 0 / 0.6)",
success: "#50e3a4",
text: "#ededed",
},
light: {
accent: "#171717",
accentContrast: "#ffffff",
backdrop: "rgb(0 0 0 / 0.48)",
background: "#ffffff",
border: "#e5e5e5",
danger: "#e5484d",
dangerContrast: "#ffffff",
fill: "#fafafa",
muted: "#666666",
radius: "0.5rem",
shadow: "0 16px 40px rgb(0 0 0 / 0.1)",
success: "#15803d",
text: "#171717",
},
},
},
{
id: "emerald",
inspiration: "Supabase",
label: "Emerald",
themes: {
dark: {
accent: "#3ecf8e",
accentContrast: "#06281c",
backdrop: "rgb(5 20 14 / 0.68)",
background: "#171717",
border: "#3a3a3a",
danger: "#f87171",
dangerContrast: "#171717",
fill: "#242424",
muted: "#a4a4a4",
radius: "0.625rem",
shadow: "0 18px 44px rgb(0 0 0 / 0.48)",
success: "#3ecf8e",
text: "#ededed",
},
light: {
accent: "#1c8c5e",
accentContrast: "#ffffff",
backdrop: "rgb(15 36 27 / 0.5)",
background: "#ffffff",
border: "#d8dedb",
danger: "#dc2626",
dangerContrast: "#ffffff",
fill: "#f3f6f4",
muted: "#5f6b65",
radius: "0.625rem",
shadow: "0 18px 44px rgb(15 36 27 / 0.12)",
success: "#1c8c5e",
text: "#1c1c1c",
},
},
},
{
id: "samva",
inspiration: "Samva",
label: "Samva",
themes: {
dark: {
accent: "#df7a36",
accentContrast: "#17140f",
backdrop: "oklch(0.08 0.01 70 / 0.68)",
background: "oklch(0.198 0.007 80)",
border: "oklch(1 0 0 / 10%)",
danger: "#f87171",
dangerContrast: "#17140f",
fill: "oklch(0.232 0.007 80)",
muted: "oklch(0.69 0.012 80)",
radius: "0.75rem",
shadow: "0 18px 44px oklch(0.08 0.01 70 / 0.52)",
success: "#34d399",
text: "oklch(0.93 0.005 80)",
},
light: {
accent: "#df7a36",
accentContrast: "#17140f",
backdrop: "oklch(0.2 0.02 70 / 0.48)",
background: "#ffffff",
border: "oklch(0.905 0.007 80)",
danger: "#dc2626",
dangerContrast: "#ffffff",
fill: "oklch(0.948 0.005 80)",
muted: "#6f675d",
radius: "0.75rem",
shadow: "0 18px 44px oklch(0.2 0.02 70 / 0.14)",
success: "#059669",
text: "#17140f",
},
},
},
{
id: "dark-plus",
inspiration: "Visual Studio Code",
label: "Dark Plus",
themes: {
dark: {
accent: "#0e639c",
accentContrast: "#ffffff",
backdrop: "rgb(0 0 0 / 0.68)",
background: "#1e1e1e",
border: "#3f3f46",
danger: "#f48771",
dangerContrast: "#1e1e1e",
fill: "#252526",
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
muted: "#a0a0a0",
radius: "0.375rem",
shadow: "0 16px 40px rgb(0 0 0 / 0.5)",
success: "#89d185",
text: "#d4d4d4",
},
light: {
accent: "#007acc",
accentContrast: "#ffffff",
backdrop: "rgb(30 30 30 / 0.48)",
background: "#ffffff",
border: "#d4d4d4",
danger: "#a1260d",
dangerContrast: "#ffffff",
fill: "#f3f3f3",
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
muted: "#616161",
radius: "0.375rem",
shadow: "0 16px 40px rgb(0 0 0 / 0.14)",
success: "#388a34",
text: "#1e1e1e",
},
},
},
{
id: "solarized",
inspiration: "Solarized",
label: "Solarized",
themes: {
dark: {
accent: "#2aa198",
accentContrast: "#002b36",
backdrop: "rgb(0 25 31 / 0.72)",
background: "#073642",
border: "#586e75",
danger: "#dc322f",
dangerContrast: "#fdf6e3",
fill: "#0b3b46",
muted: "#93a1a1",
radius: "0.5rem",
shadow: "0 16px 40px rgb(0 25 31 / 0.5)",
success: "#859900",
text: "#eee8d5",
},
light: {
accent: "#268bd2",
accentContrast: "#fdf6e3",
backdrop: "rgb(7 54 66 / 0.48)",
background: "#fdf6e3",
border: "#d5ccb8",
danger: "#dc322f",
dangerContrast: "#fdf6e3",
fill: "#eee8d5",
muted: "#657b83",
radius: "0.5rem",
shadow: "0 16px 40px rgb(88 110 117 / 0.18)",
success: "#6c7c00",
text: "#073642",
},
},
},
{
id: "tokyo-night",
inspiration: "Tokyo Night",
label: "Tokyo Night",
themes: {
dark: {
accent: "#7aa2f7",
accentContrast: "#16161e",
backdrop: "rgb(8 9 15 / 0.72)",
background: "#1a1b26",
border: "#3b4261",
danger: "#f7768e",
dangerContrast: "#16161e",
fill: "#24283b",
muted: "#a9b1d6",
radius: "0.625rem",
shadow: "0 18px 46px rgb(8 9 15 / 0.58)",
success: "#9ece6a",
text: "#c0caf5",
},
light: {
accent: "#34548a",
accentContrast: "#ffffff",
backdrop: "rgb(52 59 88 / 0.5)",
background: "#f7f7f9",
border: "#c8cbd8",
danger: "#8c4351",
dangerContrast: "#ffffff",
fill: "#e9e9ed",
muted: "#6172b0",
radius: "0.625rem",
shadow: "0 18px 46px rgb(52 84 138 / 0.16)",
success: "#587539",
text: "#343b58",
},
},
},
] as const satisfies ReadonlyArray<{
readonly id: string;
readonly inspiration: string;
readonly label: string;
readonly themes: Readonly<Record<"dark" | "light", Theme>>;
}>;

export type WorkshopThemeId = (typeof workshopThemePresets)[number]["id"];

export const isWorkshopThemeId = (value: string): value is WorkshopThemeId =>
workshopThemePresets.some((preset) => preset.id === value);

export const workshopTheme = (id: WorkshopThemeId, colorScheme: "dark" | "light"): Theme => {
const preset = workshopThemePresets.find((candidate) => candidate.id === id);
if (preset === undefined) throw new Error(`Unknown workshop theme: ${id}`);
return preset.themes[colorScheme];
};
Loading
Loading