@tetsustudio/tokens 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88 -2
- package/bin/validate-theme.mjs +18 -0
- package/dist/contract.d.ts +25 -0
- package/dist/contract.js +108 -0
- package/dist/css/base.css +78 -0
- package/dist/css/index.css +3 -0
- package/dist/css/palettes.css +101 -0
- package/dist/css/styles.css +213 -0
- package/dist/css/tailwind.css +85 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/palette.d.ts +17 -0
- package/dist/palette.js +45 -0
- package/dist/styles.d.ts +39 -0
- package/dist/styles.js +168 -0
- package/dist/themes/bloque.css +24 -0
- package/dist/themes/brasa.css +38 -0
- package/dist/themes/caramelo.css +23 -0
- package/dist/themes/chicle.css +28 -0
- package/dist/themes/hambre.css +40 -0
- package/dist/themes/laca.css +38 -0
- package/dist/themes/musgo.css +37 -0
- package/dist/themes/origami.css +38 -0
- package/dist/themes/original.css +25 -0
- package/dist/themes/papel.css +24 -0
- package/dist/themes/plano.css +30 -0
- package/dist/themes/recto.css +25 -0
- package/dist/themes/tetsu.css +32 -0
- package/dist/themes/vidrio.css +40 -0
- package/dist/themes.d.ts +3 -0
- package/dist/themes.js +3 -0
- package/package.json +49 -4
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* Tailwind v4 mapping of the Tetsu token contract. Import it after
|
|
2
|
+
'tailwindcss' and '@tetsustudio/tokens/css' in an app that uses Tailwind:
|
|
3
|
+
|
|
4
|
+
@import 'tailwindcss';
|
|
5
|
+
@import '@tetsustudio/tokens/css';
|
|
6
|
+
@import '@tetsustudio/tokens/tailwind.css';
|
|
7
|
+
|
|
8
|
+
Apps without Tailwind only need '@tetsustudio/tokens/css'. */
|
|
9
|
+
|
|
10
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
11
|
+
|
|
12
|
+
@theme inline {
|
|
13
|
+
--color-background: var(--background);
|
|
14
|
+
--color-surface: var(--surface);
|
|
15
|
+
--color-foreground: var(--foreground);
|
|
16
|
+
--color-brand: var(--brand);
|
|
17
|
+
--color-brand-foreground: var(--brand-foreground);
|
|
18
|
+
|
|
19
|
+
--color-card: var(--card);
|
|
20
|
+
--color-card-foreground: var(--card-foreground);
|
|
21
|
+
--color-popover: var(--popover);
|
|
22
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
23
|
+
--color-primary: var(--primary);
|
|
24
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
25
|
+
--color-secondary: var(--secondary);
|
|
26
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
27
|
+
--color-muted: var(--muted);
|
|
28
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
29
|
+
--color-accent: var(--accent);
|
|
30
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
31
|
+
--color-border: var(--border);
|
|
32
|
+
--color-input: var(--input);
|
|
33
|
+
--color-ring: var(--ring);
|
|
34
|
+
|
|
35
|
+
--color-destructive: var(--destructive);
|
|
36
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
37
|
+
--color-success: var(--success);
|
|
38
|
+
--color-success-foreground: var(--success-foreground);
|
|
39
|
+
--color-warning: var(--warning);
|
|
40
|
+
--color-warning-foreground: var(--warning-foreground);
|
|
41
|
+
--color-info: var(--info);
|
|
42
|
+
--color-info-foreground: var(--info-foreground);
|
|
43
|
+
|
|
44
|
+
--color-sidebar: var(--sidebar);
|
|
45
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
46
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
47
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
48
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
49
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
50
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
51
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
52
|
+
|
|
53
|
+
--color-chart-1: var(--chart-1);
|
|
54
|
+
--color-chart-2: var(--chart-2);
|
|
55
|
+
--color-chart-3: var(--chart-3);
|
|
56
|
+
--color-chart-4: var(--chart-4);
|
|
57
|
+
--color-chart-5: var(--chart-5);
|
|
58
|
+
|
|
59
|
+
--radius: var(--radius);
|
|
60
|
+
--radius-full: var(--shape-full);
|
|
61
|
+
--radius-lg: var(--shape-lg);
|
|
62
|
+
--radius-sm: calc(var(--radius) * 0.6);
|
|
63
|
+
--radius-md: calc(var(--radius) * 0.8);
|
|
64
|
+
--radius-xl: calc(var(--radius) * 1.4);
|
|
65
|
+
--radius-2xl: calc(var(--radius) * 1.8);
|
|
66
|
+
--radius-3xl: calc(var(--radius) * 2.2);
|
|
67
|
+
--radius-4xl: calc(var(--radius) * 2.6);
|
|
68
|
+
--default-border-width: var(--style-border);
|
|
69
|
+
|
|
70
|
+
--font-sans: var(--font-sans);
|
|
71
|
+
--font-heading: var(--font-heading);
|
|
72
|
+
--font-mono: var(--font-mono);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@layer base {
|
|
76
|
+
/* In v4 the default border is currentColor: without this every bare
|
|
77
|
+
`border` would take the text color instead of the theme separator. */
|
|
78
|
+
*,
|
|
79
|
+
::after,
|
|
80
|
+
::before,
|
|
81
|
+
::backdrop,
|
|
82
|
+
::file-selector-button {
|
|
83
|
+
border-color: var(--color-border);
|
|
84
|
+
}
|
|
85
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ColorTheme } from './styles.js';
|
|
2
|
+
/** CSS variables that paint one palette. */
|
|
3
|
+
export declare function paletteVariables(theme: ColorTheme): Record<string, string>;
|
|
4
|
+
interface StyleTarget {
|
|
5
|
+
style: {
|
|
6
|
+
setProperty(name: string, value: string): void;
|
|
7
|
+
};
|
|
8
|
+
classList: {
|
|
9
|
+
toggle(name: string, force?: boolean): unknown;
|
|
10
|
+
};
|
|
11
|
+
setAttribute(name: string, value: string): void;
|
|
12
|
+
}
|
|
13
|
+
/** Applies a palette to an element (usually document.documentElement). */
|
|
14
|
+
export declare function applyPalette(theme: ColorTheme, target: StyleTarget): void;
|
|
15
|
+
/** CSS for every style's default palette, light under the style and dark under `.dark`. */
|
|
16
|
+
export declare function palettesCss(themes: readonly ColorTheme[], defaults: Record<string, string>): string;
|
|
17
|
+
export {};
|
package/dist/palette.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { readableOn } from './styles.js';
|
|
2
|
+
/** CSS variables that paint one palette. */
|
|
3
|
+
export function paletteVariables(theme) {
|
|
4
|
+
const vars = {
|
|
5
|
+
'--background': theme.background,
|
|
6
|
+
'--surface': theme.surface,
|
|
7
|
+
'--foreground': theme.foreground,
|
|
8
|
+
'--brand': theme.accent,
|
|
9
|
+
'--brand-foreground': readableOn(theme.accent),
|
|
10
|
+
};
|
|
11
|
+
if (theme.mutedMix) {
|
|
12
|
+
vars['--muted-foreground'] =
|
|
13
|
+
`color-mix(in srgb, var(--foreground) ${theme.mutedMix}%, var(--background))`;
|
|
14
|
+
}
|
|
15
|
+
return vars;
|
|
16
|
+
}
|
|
17
|
+
/** Applies a palette to an element (usually document.documentElement). */
|
|
18
|
+
export function applyPalette(theme, target) {
|
|
19
|
+
target.setAttribute('data-style', theme.style);
|
|
20
|
+
target.classList.toggle('dark', theme.mode === 'dark');
|
|
21
|
+
for (const [name, value] of Object.entries(paletteVariables(theme))) {
|
|
22
|
+
target.style.setProperty(name, value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** CSS for every style's default palette, light under the style and dark under `.dark`. */
|
|
26
|
+
export function palettesCss(themes, defaults) {
|
|
27
|
+
const blocks = [
|
|
28
|
+
'/* Generated by scripts/build-css.mjs from src/styles.ts. Do not edit. */',
|
|
29
|
+
'@layer base {',
|
|
30
|
+
];
|
|
31
|
+
for (const [style, family] of Object.entries(defaults)) {
|
|
32
|
+
for (const mode of ['light', 'dark']) {
|
|
33
|
+
const theme = themes.find((t) => t.style === style && t.id === `${family}-${mode}`);
|
|
34
|
+
if (!theme)
|
|
35
|
+
continue;
|
|
36
|
+
const selector = mode === 'light' ? `html[data-style='${style}']` : `html[data-style='${style}'].dark`;
|
|
37
|
+
const body = Object.entries(paletteVariables(theme))
|
|
38
|
+
.map(([name, value]) => ` ${name}: ${value};`)
|
|
39
|
+
.join('\n');
|
|
40
|
+
blocks.push(` ${selector} {\n${body}\n }`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
blocks.push('}', '');
|
|
44
|
+
return blocks.join('\n');
|
|
45
|
+
}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface LocalizedText {
|
|
2
|
+
es: string;
|
|
3
|
+
en: string;
|
|
4
|
+
}
|
|
5
|
+
export type ThemeMode = 'light' | 'dark';
|
|
6
|
+
export declare const STYLE_IDS: readonly ["original", "recto", "papel", "bloque", "caramelo", "tetsu", "vidrio"];
|
|
7
|
+
export type StyleId = (typeof STYLE_IDS)[number];
|
|
8
|
+
export declare function isStyleId(value: unknown): value is StyleId;
|
|
9
|
+
export declare const STYLE_STORAGE_KEY = "visual-style";
|
|
10
|
+
export interface VisualStyle {
|
|
11
|
+
label: LocalizedText;
|
|
12
|
+
description: LocalizedText;
|
|
13
|
+
defaultFamily: string;
|
|
14
|
+
defaultMode: ThemeMode;
|
|
15
|
+
accentIsPrimary: boolean;
|
|
16
|
+
googleFonts?: readonly string[];
|
|
17
|
+
sample: {
|
|
18
|
+
font: string;
|
|
19
|
+
radius: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const VISUAL_STYLES: Record<StyleId, VisualStyle>;
|
|
23
|
+
export interface ColorTheme {
|
|
24
|
+
id: string;
|
|
25
|
+
style: StyleId;
|
|
26
|
+
label: LocalizedText;
|
|
27
|
+
mode: ThemeMode;
|
|
28
|
+
background: string;
|
|
29
|
+
surface: string;
|
|
30
|
+
foreground: string;
|
|
31
|
+
accent: string;
|
|
32
|
+
mutedMix?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const COLOR_THEME_PRESETS: ColorTheme[];
|
|
35
|
+
export declare function stylePalettes(style: StyleId): ColorTheme[];
|
|
36
|
+
export declare function resolveColorTheme(style: StyleId, savedThemeId: string | null, savedMode: string | null): ColorTheme;
|
|
37
|
+
export declare function isManualAccent(style: StyleId, themeId: string, mode: ThemeMode, accent: string): boolean;
|
|
38
|
+
export declare function contrastRatio(a: string, b: string): number;
|
|
39
|
+
export declare function readableOn(hex: string): "#ffffff" | "#111111";
|
package/dist/styles.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export const STYLE_IDS = [
|
|
2
|
+
'original',
|
|
3
|
+
'recto',
|
|
4
|
+
'papel',
|
|
5
|
+
'bloque',
|
|
6
|
+
'caramelo',
|
|
7
|
+
'tetsu',
|
|
8
|
+
'vidrio',
|
|
9
|
+
];
|
|
10
|
+
export function isStyleId(value) {
|
|
11
|
+
return typeof value === 'string' && STYLE_IDS.includes(value);
|
|
12
|
+
}
|
|
13
|
+
// localStorage key of the style the user picked; without one, the app's default.
|
|
14
|
+
export const STYLE_STORAGE_KEY = 'visual-style';
|
|
15
|
+
export const VISUAL_STYLES = {
|
|
16
|
+
original: {
|
|
17
|
+
label: { es: 'Original', en: 'Original' },
|
|
18
|
+
description: {
|
|
19
|
+
es: 'Píldoras, sin tarjetas y botón principal invertido.',
|
|
20
|
+
en: 'Pills, no cards and an inverted primary button.',
|
|
21
|
+
},
|
|
22
|
+
defaultFamily: 'mono',
|
|
23
|
+
defaultMode: 'dark',
|
|
24
|
+
accentIsPrimary: false,
|
|
25
|
+
sample: { font: 'var(--font-nunito)', radius: '9999px' },
|
|
26
|
+
},
|
|
27
|
+
recto: {
|
|
28
|
+
label: { es: 'Recto', en: 'Straight' },
|
|
29
|
+
description: {
|
|
30
|
+
es: 'Esquinas rectas, línea fina y más densidad.',
|
|
31
|
+
en: 'Square corners, thin lines and more density.',
|
|
32
|
+
},
|
|
33
|
+
defaultFamily: 'graphite',
|
|
34
|
+
defaultMode: 'dark',
|
|
35
|
+
accentIsPrimary: true,
|
|
36
|
+
sample: { font: 'var(--font-inter)', radius: '0px' },
|
|
37
|
+
},
|
|
38
|
+
papel: {
|
|
39
|
+
label: { es: 'Papel', en: 'Paper' },
|
|
40
|
+
description: {
|
|
41
|
+
es: 'Editorial, con serif y casi sin radios.',
|
|
42
|
+
en: 'Editorial, with serif type and barely any radius.',
|
|
43
|
+
},
|
|
44
|
+
defaultFamily: 'ink',
|
|
45
|
+
defaultMode: 'light',
|
|
46
|
+
accentIsPrimary: true,
|
|
47
|
+
sample: { font: 'var(--font-newsreader)', radius: '3px' },
|
|
48
|
+
},
|
|
49
|
+
bloque: {
|
|
50
|
+
label: { es: 'Bloque', en: 'Block' },
|
|
51
|
+
description: {
|
|
52
|
+
es: 'Bordes gruesos, sombras duras y color fuerte.',
|
|
53
|
+
en: 'Thick borders, hard shadows and strong color.',
|
|
54
|
+
},
|
|
55
|
+
defaultFamily: 'lemon',
|
|
56
|
+
defaultMode: 'light',
|
|
57
|
+
accentIsPrimary: true,
|
|
58
|
+
sample: { font: 'var(--font-archivo-black)', radius: '0px' },
|
|
59
|
+
},
|
|
60
|
+
caramelo: {
|
|
61
|
+
label: { es: 'Caramelo', en: 'Candy' },
|
|
62
|
+
description: {
|
|
63
|
+
es: 'Formas redondas y superficies tintadas.',
|
|
64
|
+
en: 'Round shapes and tinted surfaces.',
|
|
65
|
+
},
|
|
66
|
+
defaultFamily: 'grape',
|
|
67
|
+
defaultMode: 'light',
|
|
68
|
+
accentIsPrimary: true,
|
|
69
|
+
sample: { font: 'var(--font-fredoka)', radius: '20px' },
|
|
70
|
+
},
|
|
71
|
+
// From style.tetsustudio.com/s/tetsu/tokens.json: ember on near-black, the
|
|
72
|
+
// primary button stays inverted (ember marks heat and state, not buttons).
|
|
73
|
+
tetsu: {
|
|
74
|
+
label: { es: 'Tetsu', en: 'Tetsu' },
|
|
75
|
+
description: {
|
|
76
|
+
es: 'Casi negro con brasa, Inter apretada y botón principal invertido.',
|
|
77
|
+
en: 'Near-black with ember, tight Inter and an inverted primary button.',
|
|
78
|
+
},
|
|
79
|
+
defaultFamily: 'brasa',
|
|
80
|
+
defaultMode: 'dark',
|
|
81
|
+
accentIsPrimary: false,
|
|
82
|
+
sample: { font: 'var(--font-inter)', radius: '4px' },
|
|
83
|
+
},
|
|
84
|
+
// From style.tetsustudio.com/s/vidrio/tokens.json.
|
|
85
|
+
vidrio: {
|
|
86
|
+
label: { es: 'Vidrio', en: 'Glass' },
|
|
87
|
+
description: {
|
|
88
|
+
es: 'Claro y técnico: Funnel, un solo cobalto y radios chicos.',
|
|
89
|
+
en: 'Light and technical: Funnel type, a single cobalt and small radii.',
|
|
90
|
+
},
|
|
91
|
+
defaultFamily: 'cobalto',
|
|
92
|
+
defaultMode: 'light',
|
|
93
|
+
accentIsPrimary: true,
|
|
94
|
+
sample: { font: "'Funnel Display', var(--font-inter)", radius: '6px' },
|
|
95
|
+
googleFonts: ['funnel-sans', 'funnel-display', 'martian-mono'],
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
function palette(style, family, label, light, dark) {
|
|
99
|
+
return ['light', 'dark'].map((mode) => {
|
|
100
|
+
const [background, surface, foreground, accent, mutedMix] = mode === 'light' ? light : dark;
|
|
101
|
+
return {
|
|
102
|
+
id: `${family}-${mode}`,
|
|
103
|
+
style,
|
|
104
|
+
label,
|
|
105
|
+
mode,
|
|
106
|
+
background,
|
|
107
|
+
surface,
|
|
108
|
+
foreground,
|
|
109
|
+
accent,
|
|
110
|
+
...(mutedMix ? { mutedMix } : {}),
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// prettier-ignore
|
|
115
|
+
export const COLOR_THEME_PRESETS = [
|
|
116
|
+
...palette('original', 'mono', { es: 'Monocromo', en: 'Monochrome' }, ['#ffffff', '#fafafa', '#000000', '#3b82f6'], ['#090909', '#171717', '#ffffff', '#3b82f6']),
|
|
117
|
+
...palette('original', 'midnight', { es: 'Medianoche', en: 'Midnight' }, ['#fffffe', '#f2f4f6', '#00214d', '#1d5fd6', 65], ['#001534', '#00214d', '#fffffe', '#6ab0ff']),
|
|
118
|
+
...palette('recto', 'graphite', { es: 'Grafito', en: 'Graphite' }, ['#ffffff', '#f4f4f5', '#0a0a0a', '#0a0a0a'], ['#0a0a0a', '#171717', '#fafafa', '#fafafa']),
|
|
119
|
+
...palette('recto', 'blue', { es: 'Azul', en: 'Blue' }, ['#ffffff', '#f4f4f5', '#0a0a0a', '#1d4ed8'], ['#0a0a0a', '#171717', '#fafafa', '#60a5fa']),
|
|
120
|
+
...palette('recto', 'red', { es: 'Rojo', en: 'Red' }, ['#ffffff', '#f4f4f5', '#0a0a0a', '#c81e1e'], ['#0a0a0a', '#171717', '#fafafa', '#f87171']),
|
|
121
|
+
...palette('papel', 'ink', { es: 'Tinta', en: 'Ink' }, ['#eef0ea', '#f9faf6', '#14213a', '#2740b0'], ['#10182a', '#1a2439', '#e9edf2', '#8ea6ff']),
|
|
122
|
+
...palette('papel', 'olive', { es: 'Oliva', en: 'Olive' }, ['#eeecdd', '#f8f7ee', '#23261a', '#56672a'], ['#181a12', '#23261a', '#ecebd9', '#b5c46a']),
|
|
123
|
+
...palette('papel', 'wine', { es: 'Vino', en: 'Wine' }, ['#f3ecec', '#fbf7f6', '#2a1216', '#8a1c32'], ['#1c0f12', '#2a181c', '#f5e7e8', '#f0909f']),
|
|
124
|
+
...palette('bloque', 'lemon', { es: 'Limón', en: 'Lemon' }, ['#ffe34d', '#fffdf0', '#111111', '#d81b63'], ['#141414', '#232323', '#f6f5ee', '#d9ff3f']),
|
|
125
|
+
...palette('bloque', 'mint', { es: 'Menta', en: 'Mint' }, ['#b4f0cf', '#f6fff9', '#0d1f17', '#5b2be0'], ['#0d1f17', '#173026', '#effbf4', '#7dffb8']),
|
|
126
|
+
...palette('bloque', 'salmon', { es: 'Salmón', en: 'Salmon' }, ['#ffb39b', '#fff6f2', '#1c0f0b', '#1c3fe0'], ['#1c0f0b', '#2e1b15', '#fff1ea', '#ff9470']),
|
|
127
|
+
...palette('caramelo', 'grape', { es: 'Uva', en: 'Grape' }, ['#f5efff', '#ffffff', '#2a1a4a', '#7235e0'], ['#1a1230', '#271c44', '#f1eaff', '#b999ff']),
|
|
128
|
+
...palette('caramelo', 'peach', { es: 'Durazno', en: 'Peach' }, ['#fff0e6', '#ffffff', '#43210f', '#c2410c'], ['#241208', '#351d10', '#ffeadc', '#ff9a66']),
|
|
129
|
+
...palette('caramelo', 'lagoon', { es: 'Laguna', en: 'Lagoon' }, ['#e6f7f4', '#ffffff', '#0e3638', '#0b7f76'], ['#0a2526', '#123537', '#dcf7f3', '#4fd6c8']),
|
|
130
|
+
...palette('tetsu', 'brasa', { es: 'Brasa', en: 'Ember' }, ['#ffffff', '#f4f4f2', '#0b0b0c', '#e2470f'], ['#070708', '#0e0f11', '#f2f2ee', '#ff5a1f']),
|
|
131
|
+
...palette('tetsu', 'acero', { es: 'Acero', en: 'Steel' }, ['#ffffff', '#f4f4f2', '#0b0b0c', '#5e6167'], ['#070708', '#0e0f11', '#f2f2ee', '#9aa3ae']),
|
|
132
|
+
...palette('vidrio', 'cobalto', { es: 'Cobalto', en: 'Cobalt' }, ['#f3f4f1', '#ffffff', '#16191d', '#1747ff'], ['#0e1013', '#15181c', '#eceeef', '#6e8bff']),
|
|
133
|
+
...palette('vidrio', 'grafito', { es: 'Grafito', en: 'Graphite' }, ['#f3f4f1', '#ffffff', '#16191d', '#16191d'], ['#0e1013', '#15181c', '#eceeef', '#eceeef']),
|
|
134
|
+
];
|
|
135
|
+
export function stylePalettes(style) {
|
|
136
|
+
return COLOR_THEME_PRESETS.filter((preset) => preset.style === style);
|
|
137
|
+
}
|
|
138
|
+
// A saved palette wins over the style. A palette that no longer exists, or that
|
|
139
|
+
// belongs to another style, falls back to the style's default with the saved mode.
|
|
140
|
+
export function resolveColorTheme(style, savedThemeId, savedMode) {
|
|
141
|
+
const palettes = stylePalettes(style);
|
|
142
|
+
const saved = palettes.find((preset) => preset.id === savedThemeId);
|
|
143
|
+
if (saved)
|
|
144
|
+
return saved;
|
|
145
|
+
const { defaultFamily, defaultMode } = VISUAL_STYLES[style];
|
|
146
|
+
const mode = savedMode === 'light' || savedMode === 'dark' ? savedMode : defaultMode;
|
|
147
|
+
return palettes.find((preset) => preset.id === `${defaultFamily}-${mode}`);
|
|
148
|
+
}
|
|
149
|
+
// An exported theme always carries the current accent. When it is the
|
|
150
|
+
// palette's own, the user did not pick it and it must follow the palette.
|
|
151
|
+
export function isManualAccent(style, themeId, mode, accent) {
|
|
152
|
+
return resolveColorTheme(style, themeId, mode).accent !== accent.toLowerCase();
|
|
153
|
+
}
|
|
154
|
+
function luminance(hex) {
|
|
155
|
+
const channel = (start) => {
|
|
156
|
+
const value = parseInt(hex.slice(start, start + 2), 16) / 255;
|
|
157
|
+
return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
158
|
+
};
|
|
159
|
+
return 0.2126 * channel(1) + 0.7152 * channel(3) + 0.0722 * channel(5);
|
|
160
|
+
}
|
|
161
|
+
export function contrastRatio(a, b) {
|
|
162
|
+
const [x, y] = [luminance(a), luminance(b)];
|
|
163
|
+
return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
|
|
164
|
+
}
|
|
165
|
+
// Readable text color on top of a color.
|
|
166
|
+
export function readableOn(hex) {
|
|
167
|
+
return contrastRatio('#ffffff', hex) >= contrastRatio('#111111', hex) ? '#ffffff' : '#111111';
|
|
168
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* bloque as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="bloque"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;700&family=Archivo+Black&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='bloque'] {
|
|
6
|
+
--radius: 0px;
|
|
7
|
+
--shape-lg: 0px;
|
|
8
|
+
--shape-full: 0px;
|
|
9
|
+
--font-sans: Archivo, ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-heading: 'Archivo Black', Archivo, ui-sans-serif, system-ui, sans-serif;
|
|
11
|
+
--background: #ffe34d;
|
|
12
|
+
--surface: #fffdf0;
|
|
13
|
+
--foreground: #111111;
|
|
14
|
+
--brand: #d81b63;
|
|
15
|
+
--brand-foreground: #ffffff;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
html[data-style='bloque'].dark {
|
|
19
|
+
--background: #141414;
|
|
20
|
+
--surface: #232323;
|
|
21
|
+
--foreground: #f6f5ee;
|
|
22
|
+
--brand: #d9ff3f;
|
|
23
|
+
--brand-foreground: #000000;
|
|
24
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* brasa as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="brasa"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@700;800;900&family=Newsreader:ital,opsz,wght@0,6..72,300..500;1,6..72,300..500&family=Schibsted+Grotesk:wght@400;500;600&family=Martian+Mono:wdth,wght@87.5,400&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='brasa'] {
|
|
6
|
+
--radius: 2px;
|
|
7
|
+
--shape-lg: 8px;
|
|
8
|
+
--font-sans: 'Schibsted Grotesk', ui-sans-serif, system-ui, sans-serif;
|
|
9
|
+
--font-heading: 'Big Shoulders Display', 'Schibsted Grotesk', ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-mono: 'Martian Mono', ui-monospace, monospace;
|
|
11
|
+
--background: #F3EBDF;
|
|
12
|
+
--surface: #ebe3d8;
|
|
13
|
+
--foreground: #0F0B09;
|
|
14
|
+
--brand: #d94d1a;
|
|
15
|
+
--brand-foreground: #000000;
|
|
16
|
+
--destructive: #bf6858;
|
|
17
|
+
--destructive-foreground: #000000;
|
|
18
|
+
--success: #768674;
|
|
19
|
+
--success-foreground: #000000;
|
|
20
|
+
--warning: #a98135;
|
|
21
|
+
--warning-foreground: #000000;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
html[data-style='brasa'].dark {
|
|
25
|
+
--background: #0F0B09;
|
|
26
|
+
--surface: #1A1411;
|
|
27
|
+
--foreground: #F3EBDF;
|
|
28
|
+
--brand: #FF5A1F;
|
|
29
|
+
--brand-foreground: #0F0B09;
|
|
30
|
+
--muted-foreground: #9A8E83;
|
|
31
|
+
--border: #2E2620;
|
|
32
|
+
--destructive: #FF8A75;
|
|
33
|
+
--destructive-foreground: #000000;
|
|
34
|
+
--success: #9DB39A;
|
|
35
|
+
--success-foreground: #000000;
|
|
36
|
+
--warning: #F2B84B;
|
|
37
|
+
--warning-foreground: #000000;
|
|
38
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* caramelo as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="caramelo"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&family=Fredoka:wght@500;600&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='caramelo'] {
|
|
6
|
+
--radius: 20px;
|
|
7
|
+
--shape-lg: 20px;
|
|
8
|
+
--font-sans: Nunito, ui-sans-serif, system-ui, sans-serif;
|
|
9
|
+
--font-heading: Fredoka, Nunito, ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--background: #f5efff;
|
|
11
|
+
--surface: #ffffff;
|
|
12
|
+
--foreground: #2a1a4a;
|
|
13
|
+
--brand: #7235e0;
|
|
14
|
+
--brand-foreground: #ffffff;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html[data-style='caramelo'].dark {
|
|
18
|
+
--background: #1a1230;
|
|
19
|
+
--surface: #271c44;
|
|
20
|
+
--foreground: #f1eaff;
|
|
21
|
+
--brand: #b999ff;
|
|
22
|
+
--brand-foreground: #000000;
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* chicle as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="chicle"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=Anybody:ital,wdth,wght@0,50..150,100..900;1,50..150,100..900&family=Host+Grotesk:wght@400;500;700&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='chicle'] {
|
|
6
|
+
--radius: 16px;
|
|
7
|
+
--shape-full: 9999px;
|
|
8
|
+
--font-sans: 'Host Grotesk', ui-sans-serif, system-ui, sans-serif;
|
|
9
|
+
--font-heading: Anybody, 'Host Grotesk', ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--background: #FF5CA8;
|
|
11
|
+
--surface: #FFF6FB;
|
|
12
|
+
--foreground: #1A0B2E;
|
|
13
|
+
--brand: #779223;
|
|
14
|
+
--brand-foreground: #1A0B2E;
|
|
15
|
+
--muted-foreground: #6B5A7A;
|
|
16
|
+
--destructive: #C8104F;
|
|
17
|
+
--destructive-foreground: #ffffff;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
html[data-style='chicle'].dark {
|
|
21
|
+
--background: #1A0B2E;
|
|
22
|
+
--surface: #281035;
|
|
23
|
+
--foreground: #FF5CA8;
|
|
24
|
+
--brand: #779223;
|
|
25
|
+
--brand-foreground: #000000;
|
|
26
|
+
--destructive: #C8104F;
|
|
27
|
+
--destructive-foreground: #ffffff;
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* hambre as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="hambre"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wdth,wght@12..96,75..100,400..800&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='hambre'] {
|
|
6
|
+
--radius: 6px;
|
|
7
|
+
--shape-lg: 20px;
|
|
8
|
+
--shape-full: 14px;
|
|
9
|
+
--font-sans: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-heading: 'Bricolage Grotesque', 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
|
|
11
|
+
--background: #fff7ed;
|
|
12
|
+
--surface: #ffffff;
|
|
13
|
+
--foreground: #3b1f12;
|
|
14
|
+
--brand: #c2410c;
|
|
15
|
+
--brand-foreground: #fff7ed;
|
|
16
|
+
--muted-foreground: #725b4f;
|
|
17
|
+
--border: #e4d9ce;
|
|
18
|
+
--destructive: #ff5f56;
|
|
19
|
+
--destructive-foreground: #000000;
|
|
20
|
+
--success: #27c93f;
|
|
21
|
+
--success-foreground: #000000;
|
|
22
|
+
--warning: #ffbd2e;
|
|
23
|
+
--warning-foreground: #000000;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
html[data-style='hambre'].dark {
|
|
27
|
+
--background: #221a16;
|
|
28
|
+
--surface: #2e241f;
|
|
29
|
+
--foreground: #fff1e4;
|
|
30
|
+
--brand: #c94c20;
|
|
31
|
+
--brand-foreground: #000000;
|
|
32
|
+
--muted-foreground: #c1b5aa;
|
|
33
|
+
--border: #453c37;
|
|
34
|
+
--destructive: #ff5f56;
|
|
35
|
+
--destructive-foreground: #000000;
|
|
36
|
+
--success: #27c93f;
|
|
37
|
+
--success-foreground: #000000;
|
|
38
|
+
--warning: #ffbd2e;
|
|
39
|
+
--warning-foreground: #000000;
|
|
40
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* laca as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="laca"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=Bodoni+Moda:ital,opsz,wght@0,6..96,400..600;1,6..96,400..600&family=Hanken+Grotesk:wght@300..600&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='laca'] {
|
|
6
|
+
--radius: 14px;
|
|
7
|
+
--shape-lg: 28px;
|
|
8
|
+
--shape-full: 9999px;
|
|
9
|
+
--font-sans: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-heading: 'Bodoni Moda', 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
|
|
11
|
+
--background: #F1EEEF;
|
|
12
|
+
--surface: #e9e6e7;
|
|
13
|
+
--foreground: #160407;
|
|
14
|
+
--brand: #8d7f65;
|
|
15
|
+
--brand-foreground: #000000;
|
|
16
|
+
--destructive: #b36f6f;
|
|
17
|
+
--destructive-foreground: #000000;
|
|
18
|
+
--success: #768d7e;
|
|
19
|
+
--success-foreground: #000000;
|
|
20
|
+
--warning: #90856c;
|
|
21
|
+
--warning-foreground: #000000;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
html[data-style='laca'].dark {
|
|
25
|
+
--background: #160407;
|
|
26
|
+
--surface: #220A0F;
|
|
27
|
+
--foreground: #F1EEEF;
|
|
28
|
+
--brand: #D9C39C;
|
|
29
|
+
--brand-foreground: #1A0508;
|
|
30
|
+
--muted-foreground: #B9A5A9;
|
|
31
|
+
--border: #4A1A22;
|
|
32
|
+
--destructive: #FF9E9E;
|
|
33
|
+
--destructive-foreground: #000000;
|
|
34
|
+
--success: #A8C9B4;
|
|
35
|
+
--success-foreground: #000000;
|
|
36
|
+
--warning: #F0DDB4;
|
|
37
|
+
--warning-foreground: #000000;
|
|
38
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* musgo as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="musgo"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=Piazzolla:opsz,wght@8..30,300..500&family=Ysabeau+Office:wght@400..600&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='musgo'] {
|
|
6
|
+
--radius: 16px;
|
|
7
|
+
--shape-full: 9999px;
|
|
8
|
+
--font-sans: 'Ysabeau Office', ui-sans-serif, system-ui, sans-serif;
|
|
9
|
+
--font-heading: Piazzolla, 'Ysabeau Office', ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--background: #E1E2D5;
|
|
11
|
+
--surface: #ECEBE2;
|
|
12
|
+
--foreground: #1E211C;
|
|
13
|
+
--brand: #2F4A33;
|
|
14
|
+
--brand-foreground: #ECEBE2;
|
|
15
|
+
--muted-foreground: #565B4E;
|
|
16
|
+
--border: #A9AB99;
|
|
17
|
+
--destructive: #97391F;
|
|
18
|
+
--destructive-foreground: #ffffff;
|
|
19
|
+
--success: #2F4A33;
|
|
20
|
+
--success-foreground: #ffffff;
|
|
21
|
+
--warning: #7A5810;
|
|
22
|
+
--warning-foreground: #ffffff;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
html[data-style='musgo'].dark {
|
|
26
|
+
--background: #1E211C;
|
|
27
|
+
--surface: #2a2d27;
|
|
28
|
+
--foreground: #E1E2D5;
|
|
29
|
+
--brand: #6d8070;
|
|
30
|
+
--brand-foreground: #000000;
|
|
31
|
+
--destructive: #a75741;
|
|
32
|
+
--destructive-foreground: #ffffff;
|
|
33
|
+
--success: #637766;
|
|
34
|
+
--success-foreground: #ffffff;
|
|
35
|
+
--warning: #876928;
|
|
36
|
+
--warning-foreground: #ffffff;
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* origami as a Tetsu theme. Generated by scripts/theme-css.mjs from tokens.json; do not edit.
|
|
2
|
+
Use: <html data-style="origami"> (add class="dark" for dark) with @tetsustudio/tokens/css. */
|
|
3
|
+
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@800;900&family=Atkinson+Hyperlegible+Next:wght@400;500;700&display=swap');
|
|
4
|
+
|
|
5
|
+
html[data-style='origami'] {
|
|
6
|
+
--radius: 14px;
|
|
7
|
+
--shape-lg: 6px;
|
|
8
|
+
--shape-full: 14px;
|
|
9
|
+
--font-sans: 'Atkinson Hyperlegible Next', ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-heading: 'M PLUS Rounded 1c', 'Atkinson Hyperlegible Next', ui-sans-serif, system-ui, sans-serif;
|
|
11
|
+
--background: #F6EFE2;
|
|
12
|
+
--surface: #FFFBF4;
|
|
13
|
+
--foreground: #2B2320;
|
|
14
|
+
--brand: #CF3A2D;
|
|
15
|
+
--brand-foreground: #FFFFFF;
|
|
16
|
+
--muted-foreground: #6B5D53;
|
|
17
|
+
--border: #D9CBB2;
|
|
18
|
+
--destructive: #A82B21;
|
|
19
|
+
--destructive-foreground: #ffffff;
|
|
20
|
+
--success: #1D6A72;
|
|
21
|
+
--success-foreground: #ffffff;
|
|
22
|
+
--warning: #C98F14;
|
|
23
|
+
--warning-foreground: #000000;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
html[data-style='origami'].dark {
|
|
27
|
+
--background: #2B2320;
|
|
28
|
+
--surface: #372f2c;
|
|
29
|
+
--foreground: #F6EFE2;
|
|
30
|
+
--brand: #d44e42;
|
|
31
|
+
--brand-foreground: #000000;
|
|
32
|
+
--destructive: #b9554d;
|
|
33
|
+
--destructive-foreground: #ffffff;
|
|
34
|
+
--success: #347980;
|
|
35
|
+
--success-foreground: #ffffff;
|
|
36
|
+
--warning: #C98F14;
|
|
37
|
+
--warning-foreground: #000000;
|
|
38
|
+
}
|