Generate color schemes from a background color, accent color, and optional foreground color
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.5KB

acid16

It makes base16 schemes. Pass a background color, an accent color, and optionally a foreground text color, and out comes a color scheme.

Color arguments are in the form of “hue,chroma,luminance” for background and “hue,chroma” for the other two. All values must be numbers between 0.0 and 1.0 (you're welcome to try other values, just don't be shocked if it breaks). Also, keep in mind luminance in HCL is relative luminance, or the color's brightness as perceived by the human eye. It also uses linear color ramping instead of the usual gamma-encoded sRGB, so something like “0.0,0.0,0.25” won't get you the 25% gray you're used to.

The script will do its best to make sure everything is readable. It tries to keep a contrast ratio of 7:1 between the foreground and background colors, while trying to stay above 3:1 for foreground and highlight, the “rainbow” colors (i.e. the last 8 colors) and highlight, and the “dark” foreground and background. Usually it does a good job. But it tends not to like a background luminance that hovers around 0.3, that's when stuff gets to be an eyesore.

Prerequisites

  • Python 3
  • Pillow
  • ImageMagick (for previews)

Options

  • -n name, -a author: Set the scheme and author name.
  • -b: Don't darken the last color (brown).
  • -e: Equiluminant mode; uses the same luminance for the last 8 colors. This keeps their brightness uniform but can make them harder to tell apart.
  • -r amount: Make the last 8 colors blend with the background hue. 0.0 means no blending, 1.0 makes them the same exact color. If you'd like to have them be the same hue but with different brightnesses, use a value like 0.999.
  • -p: Generate a preview image demonstrating color contrast and the palette itself.

Notes

On luminance options

Seems like the only usable ranges for background luminance at the moment are 0.00 to 0.10 and 0.31 to 1.00.

While 0.08 to 0.10 are usable, colors base05 to base07 are extremely similar to one another. Not that it matters since base06 and base07 are allegedly uncommon. Starting at 0.11, the script can no longer maintain its contrast levels since the foreground brightness it wants is out of range. This only gets worse until 0.25, at which point the “rainbow” hues just break down (though this could be mitigated).

From 0.26 to 0.30 the contrasts are just a huge mess. The foreground and comment colors are brighter than the background, but the rainbow hues are extremely dark. This stops being a problem at 0.31, at which case all text colors are darker than the background.