by shubhamjain · 1mo ago · 0 comments
Why? Why? Why? I hate how everyone seems convinced they need to adopt the latest and greatest browser features just to stay relevant. I hate oklch and I hate Tailwind popularized it. I don't care how scientifically accurate it is at representing human color perception. It's a PITA to understand a new type of color system, and learn to tweak it, especially when HSL/RGB just worked fine.
This just seems to me like (1) not wanting to learn new things, (2) a logical fallacy because the conclusion that those changes are to "stay relevant" and not to make the life of any future mantainer easier, and (3) fear of the new (https://en.wikipedia.org/wiki/Neophobia)
There's not "120 degrees of red, 120 degrees of green, 120 degrees of blue", so blue is not 240. Actual bright blue is hue 264. The "0-255 RGB" bright blue is 0.452 lightness, and max chroma on a really good monitor is something like 0.33. The lightness mostly makes sense, right? 0.5 is halfway between totally dark and completely washed out.
"Ok, so chroma tops at at 0.33" not so fast. You can crank up the chroma to 0.40 and still get either magenta (where lightness is around 0.74) or green (lightness around 0.78). So now you need to know a valid, nonlinear lightness range for each band of colors, because midpoint blue is different than midpoint red which is different from midpoint green.
From greyscale luminosity calculations and knowing about subpixels and bayer filters, I would've been able to guess that green is the color with the highest chroma, but then there's bright magenta, neck-and-neck. Oh. Until I move the lightness slider down on the web color picker, and then everything (especially peaks) in the chroma channel shifts around dramatically... So much for intuition.
While OKLCH makes it really convenient to select colors with properties you like along a gradient, the nonlinearity means either memorizing a bunch of base colors, using a color picker, or converting from a system that is "actually" intuitive. I can't really look at a trio of OKLCH numbers and predict the output color like I'd be able to with RGB, although this is mindful that RGB is also not linear (for the exact opposite reason as OKLCH) and I can only do that from decades of experience.
I'll concede that magenta and bright green and bold blue don't really have a place on the world wide web other than in a company logo, so these are outliers. Still, the OKLCH format is not what I'd call intuitive to a total beginner.
(Also, I'd very much not like to implement OKLCH calculations on a microcontroller until lighting companies start selling OKLCH LEDs.)
What justification do you have to adopt and replace this with existing solutions with such urgency? Have you researched its compatibility? Are you providing any fallback?
This just seem to like 1) you are not applying your mind why you want this, 2) faulty premise that it makes it easier, because in reality your software never reaches a point of maturity, where its just "done", and 3) shiny object syndrome (https://en.wikipedia.org/wiki/Shiny_object_syndrome)
After I read the same I thought, ok, that's what _they_ wanted to do.
Me? I'd love to see what could be rewritten to be 100% future proofed for as many years as possible. But see what that did? I have to share, and see if anyone else already thought of this (I doubt I'm the first ever to have this thought), and maybe, I'll be lucky enough to benefit from someone exploring it already, before I decide to put on a jedi robe and wave my hands to use the force to move AI around.
Alas, in terms of the software people use to mock up designs, very few desktop apps support it. HSL is, for now, the more practical option.
Take bright yellows as one of the worst examples. Basically the only thing you can do with them is reduce the chroma: any other change will take you out of gamut. As the most extreme case, #ff0 is approximately oklch(0.968 0.211 109.77), and the following minuscule modifications will take it out of gamut: L + 0.0002, L − 0.0001, C + 0.0002, H − 0.009 or H + 0.025.
This is why the creator massaged them into a cube/cylinder: https://bottosson.github.io/posts/colorpicker/, Okhsv and Okhsl. Those are much closer to being uniformly superior to sRGB.
Presumably we can deprecate the broken shit if we can get people to buy into software upgrades.
I see how position-anchor and stuff are coll for complex layouts, but they have poor support on low-power mobile browsers, and, frankly, are not that useful for a minimalistic CSS framework. If you want complicated layouts with non-obvious anchoring rules, you're not the target audience.
Cascade layers are very useful for complex designs with many independently added stylesheets. They would be great to have. OTOH again, if you need this level of complexity, you're likely not the target audience of a pico-sized CSS framework.
I would say that a minimalist framework should make judicious use of CSS3 features, and not try to be excessively clever. In reliable engineering, being smart often means avoiding being clever.