-
-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
Provide examples to specifying Tailwind colors (or mapping to existing theme colors with other frameworks).
Would be nice to provide integration examples for:
shadcn-svelte
tailwind.config.ts
export default {
content: [
"./src/**/*.{html,js,svelte,ts}",
"./node_modules/layerchart/**/*.{svelte,js}"
],
theme: {
extend: {
colors: {
surface: {
content: "hsl(var(--card-foreground) / <alpha-value>)",
100: "hsl(var(--background) / <alpha-value>)",
200: "hsl(var(--muted) / <alpha-value>)",
// not sure what color maps here (should be darker than 200). Could add a new color to `app.css`
300: "hsl(var(--muted) / <alpha-value>)"
}
}
},
},
};Skeleton 2
tailwind.config.ts
export default {
content: [
'./src/**/*.{html,js,svelte,ts}',
'./node_modules/layerchart/**/*.{svelte,js}',
join(require.resolve(
'@skeletonlabs/skeleton'),
'../**/*.{html,js,svelte,ts}'
)],
theme: {
extend: {
colors: {
'surface-100': 'rgb(var(--theme-color-surface-100) / <alpha-value>)',
'surface-200': 'rgb(var(--theme-color-surface-200) / <alpha-value>)',
'surface-300': 'rgb(var(--theme-color-surface-300) / <alpha-value>)',
'surface-content': 'rgb(var(--theme-color-surface-content) / <alpha-value>)',
}
},
},
};app.css (or anywhere to define CSS)
/* `:root` doesn't work as needs to be a descendant of `:root` where Skeleton defined `--color-*` */
body {
--theme-color-surface-100: var(--color-surface-50);
--theme-color-surface-200: var(--color-surface-100);
--theme-color-surface-300: var(--color-surface-200);
--theme-color-surface-content: var(--theme-font-color-base);
html.dark & {
--theme-color-surface-100: var(--color-surface-700);
--theme-color-surface-200: var(--color-surface-800);
--theme-color-surface-300: var(--color-surface-900);
--theme-color-surface-content: var(--theme-font-color-dark);
}
}Skeleton 3
@source '../node_modules/layerchart/dist';
/* TODO: what is most common for Skeleton 3 setup */
@custom-variant dark (&:where([data-mode="dark"], [data-mode="dark"] *));
@theme {
/* Define additional color (Skeleton provides all the other `surface-*` colors (but they need remapped for charts */
--color-surface-content: var(--base-font-color);
}
.lc-root-container {
--color-surface-100: var(--color-surface-50);
--color-surface-200: var(--color-surface-100);
--color-surface-300: var(--color-surface-200);
--color-surface-content: var(--base-font-color);
html[data-mode="dark"] & {
--color-surface-100: var(--color-surface-700);
--color-surface-200: var(--color-surface-800);
--color-surface-300: var(--color-surface-900);
--color-surface-content: var(--base-font-color-dark);
}
}Daisy UI
Daisy UI 4 (TW3)
tailwind.config.ts
export default {
content: [
"./src/**/*.{html,js,svelte,ts}",
"./node_modules/layerchart/**/*.{svelte,js}"
],
theme: {
extend: {
colors: {
'surface-100': 'oklch(var(--b1) / <alpha-value>)',
'surface-200': 'oklch(var(--b2) / <alpha-value>)',
'surface-300': 'oklch(var(--b3) / <alpha-value>)',
'surface-content': 'oklch(var(--bc) / <alpha-value>)',
}
},
},
};Daisy UI 5 (TW4)
app.css
@source '../node_modules/layerchart/dist';
@theme {
--color-surface-100: var(--color-base-100);
--color-surface-200: var(--color-base-200);
--color-surface-300: var(--color-base-300);
--color-surface-content: var(--color-base-content);
}Tailwind only
tailwind.config.ts
export default {
content: [
"./src/**/*.{html,js,svelte,ts}",
"./node_modules/layerchart/**/*.{svelte,js}"
],
theme: {
extend: {
colors: {
primary: "hsl(var(--color-primary) / <alpha-value>)",
surface: {
100: "hsl(var(--color-surface-100) / <alpha-value>)",
200: "hsl(var(--color-surface-200) / <alpha-value>)",
300: "hsl(var(--color-surface-300) / <alpha-value>)",
content: "hsl(var(--color-surface-content) / <alpha-value>)"
}
}
},
},
};app.css (or anywhere to define CSS)
:root {
--color-primary: 257.4075 100% 50%;
--color-surface-100: 180 100% 100%;
--color-surface-200: 0 0% 94.902%;
--color-surface-300: 180 1.9608% 90%;
--color-surface-content: 215 27.907% 16.8627%;
}flowbite
Doesn't appear to use CSS variables (just Tailwind defined colors), which makes integration challenging.
plckr, helloimwit, cbenz, JacobO1 and leomorpholeomorpho
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
Done