[v4] Palette gen / dyn-colors with oklch #13628
domlen2003
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Motivation
I read an article about using oklch and tailwindcss for a better color palette as well as dynamic colours.
I thought there has to be a better way to integrate automatically generated palettes.
This led to me analyzing the current tailwind colors with a python script and hacking together a script for dynamically generated color variants based on the current tailwindcss colors.
Also when configuring a color with a variable oklch hue you can do really cool stuff with reactive colors as shown in the aforementioned blogpost.
Idea
Since tailwindcss v4 is planning to add better support for oklch and updating the color scheme to a wider gamut, this would also be the perfect time to support the features mentioned above.
I don't have a clear idea for config/syntax, but the features would be:
primary
and then use e.g.bg-primary-700
for a darker shade butbg-primary
would still give you the original color--dyn-1
so you can use e.g.bg-dyn-1-700
and change its hue dynamically my modifying--dyn-1
max-chroma
,balanced
ormax-consistency
for default palette (and custom colors?)Option
max-choma
would be the maximum available chroma for a specific hue and lightness.Option
max-consisntency
would be the min chroma across all colors for a specific lightness.Option
balanced
could be inbetween by takingmax-consistency
and multiplying chroma by a factor of e.g. max 1.2 based on the available chroma for that specific color.Problems
Supporting hue vars
max-chroma
andbalanced
) can't be done because this would also need a fixed hue.This problem could be addressed with a bit of client side js code but thats probably unwanted in a "pure" css library.
Beta Was this translation helpful? Give feedback.
All reactions