-
-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
Tailwind 4 now declares CSS variables WITH a color function such as:
@import 'tailwindcss';
@source '../node_modules/layerchart/**/*.{svelte,js}';
@theme {
--color-primary: hsl(257.4075 100% 50%);
--color-surface-100: hsl(180 100% 100%);
--color-surface-200: hsl(0 0% 94.902%);
--color-surface-300: hsl(180 1.9608% 90%);
--color-surface-content: hsl(215 27.907% 16.8627%);
}which means they are now used via var(--color-primary) instead of hsl(var(--color-primary)) when referenced directly, such as for the default series color. Both TW3 and TW4 work the same when used via a class, such as fill-primary or stroke-surface-content.
Declaring with the color function is much nicer as this means all color functions (hsl(), rgb(), oklch(), ...) can be used out of the box without needing to know the original color space.
In LayerChart 2.0 we will default to Tailwind 4 usage, but until then, you can explicitly provide the default series color using:
<AreaChart
{data}
x="date"
y="value"
series={[{ key: 'value', color: 'var(--color-primary)' }]}
/>See this repo for an example.
shiftgeist
Metadata
Metadata
Assignees
Labels
No labels