Skip to content

The gray palette is not symmetric when "inverted" #6

@everdimension

Description

@everdimension

A common pattern to create light and dark theme is to define variables like the following:

@media (prefers-color-scheme: light) {
  :where(html) {
    --neutral-0: var(--gray-0);
    --neutral-1: var(--gray-1);
    /** ...and so on... */
    --neutral-11: var(--gray-11);
    --neutral-12: var(--gray-12);
  }
}

/** For dark theme, define values in the "opposite" order */
@media (prefers-color-scheme: dark) {
  :where(html) {
    --neutral-0: var(--gray-12);
    --neutral-1: var(--gray-11);
    /** ...and so on... */
    --neutral-11: var(--gray-1);
    --neutral-12: var(--gray-0);
  }
}

This doesn't work very well with the current palette. You can see here, that while var(--gray-1) is clearly visible on white background, var(--gray-11) is not clearly visible on the black background.

image image

Btw, I think a similar problem can be observed in your article:
Here, on black background the rectangles "8" and "9" are defined well, but on the white background they're indistinguishable:
image
image

I am not sure this is something that can be fixed in a general way, but if it's possible, it would be quite helpful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions