I spent some time rethinking how color is represen...
# share-your-work
k
I spent some time rethinking how color is represented in my browser. I want to prioritize accessibility over expression, so I switched to ~500 colors over a perceptually uniform color space. The idea is that you specify background colors completely, but if you leave wiggle room in the foreground colors the browser will search the wiggle room and try to maintain some minimum contrast level. Here's a test run where I randomize the background on every "page load", but the foreground colors are specified the same way: text is on a greyscale, and links are blue. I used to think the CSS hotness of the Oklab space is rocket science. I still don't understand the why of it, but it turns out to only take 200 lines of code to implement.
r
Colors are fun! With modern color functions there, you can also do a lot of that just in native CSS, like with relative color syntax here: https://lea.verou.me/blog/2024/contrast-color/
k
Oh that's fascinating about the limitations of WCAG. I was noticing as well while playing with my program, wondering if I have a bug somewhere.
e
Thanks for sharing your Oklab code! Excited to come back to it later when doing color stuff
e
<tooting-own-horn> I wrote about the “why” of the ok* spaces last year: https://ericportis.com/posts/2024/okay-color-spaces/
k
That was extremely helpful, thank you @Eric Portis!