wiki/2020-11-05-17-21-58.org
2021-05-05 00:07:40 +08:00

1.8 KiB

Generate a color scheme based from a single color

Generating human-friendly color schemes has always been a disaster (for me) to figure out especially with no cursory knowledge whatsoever on color theory. So I've been thinking how to do such thing with the result that doesn't make gouge my eyes out.

Thus, for the solution, we'll include some opinionated things.

  • Generate a color with the HSLuv color space since it is .
  • The color palette is composed of 16 colors inspired on Nord's documented color scheme. This easily provides a Base16 color scheme generator.
  • If the given color is bright, it should create a light theme.

Here's the procedure for the color sections.

  • For base00, invert the lightness of the color by $\pm20$ (e.g., $20$ if it's dark, $80$ if it's bright).
  • For base01 to base07, add the lightness by $\pm5$ to $\pm10$. You can make additional tweaks for all of the parameters (e.g., hue, saturation, lightness) of the color.
  • On base08 to base0F, you can make a uniquely randomized color palette as long as it is recognizable (ideally with at least 3 colors).

What if we want to make changes to the generation process? One way to do it is to separate the hardcoded process into a configuration. From there, we can set various procedures such as the usual Base16 scheme, terminal.sexy, or your own.