Alexey Ardov Profile picture
Jan 25 8 tweets 4 min read
Tried generating themes based on APCA contrast and OKLCH color model. Well, it's not as easy as I thought, but I'm pretty happy with the first results.

You can play with it here color-playground.ardov.me
Light theme is relatively easy to make. But when it comes to dark the real challenge arises. Most of my methods just failed.

Let’s explore a dead simple example: white background + gray card.

How to convert it to the dark theme and keep that subtle contrast?
Let’s start with the familiar HSL.
The lightness of white is 100%, and of gray is 92% (8% of difference)

So in the dark theme, it should be 0% and 8% (same 8%)

Well, the result seems a little too dark for me
But we have that shiny perceptual color space OKLCH. Let’s do the same trick with its luminance!

Aaaand it fails completely much worse than HSL.
What if we use a contrast ratio?
Knowing the contrast between the background and the card we can recreate it in the dark theme.

That sounds good let’s try the new APCA algorithm!

Aaaand it’s too bright. We don’t need that much contrast here.
Ok, maybe the good old WCAG will do the job?

And it actually does! Finally, we have that nice subtle contrast in the dark theme.
To be fair most of the methods work better when the background is not entirely black.

I also tried it with a brighter background and all of them (except APCA) worked fine.

Here is the full comparison table
What's the moral? Never trust a color space completely it can fail in super simple tasks.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Alexey Ardov

Alexey Ardov Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @ardovalexey

Oct 10, 2021
Huetone is here! 🌈
It's the tool you need to create and fine-tune your color system.

Details in thread
huetone.ardov.me
Color systems should be predictable in terms of contrasts. It makes them easy to use. If you can easily replace "blue-500" with "orange-500", your palette is well constructed.

Huetone helps you build such systems by visualizing your palette and contrasts between colors.
For visualization, Huetone uses LCH color space.
LCH stands for Lightness, Chroma, and Hue.
Unlike RGB or HSL, it is perceptually uniform and covers all the colors a human can see.

Note that we are still limited to our RGB monitors, and some colors will be undisplayable. Image
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(