acid16/README.md

45 lines
3.3 KiB
Markdown
Raw Normal View History

2021-09-14 00:06:30 -04:00
# acid16
2021-12-09 17:23:12 -05:00
It makes color schemes. Pass a background color, an accent color, and optionally a foreground text color, and out comes a color scheme.
2021-09-14 00:06:30 -04:00
The program uses a quasi-[HCL](https://en.wikipedia.org/wiki/HCL_color_space) color model. 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. So pure yellow has more luminance than pure blue. 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 \#404040 you'd expect. This can be overridden by passing `--hsl`, that way you can use a good old HSL color straight from your color picker.
2021-09-14 00:06:30 -04:00
The script will do its best to make sure everything is readable. With Base16, for instance, it tries to keep a contrast ratio of 7:1 between the foreground and background colors, while trying to stay above 4.5:1 for foreground and highlight, the last 8 colors (the "hues") and highlight, and the "dark" foreground and background. Usually it does a good job. But with the way it handles contrast, things get unreadable with some values (see "On luminance options").
2021-09-14 00:06:30 -04:00
## Example
```
./acid16.py 0.6,0.25,0.005 0.6,0.5 0.0,0.0
```
This creates a color scheme with:
- A dark bluish background (hue 0.6, chroma 0.25, luminance 0.005)
- An accent color with that same hue but more saturation (hue 0.6, chroma 0.5)
- Some shade of gray for the foreground color (hue 0.0, chroma 0.0). In this case it'll be a light gray since the background is dark.
## Prerequisites
- Python 3
- Pillow
## Options
2021-12-09 17:23:12 -05:00
***Obligatory "options are subject to change" courtesy warning***
- `-m mode`: Which generator to use. Current generators:
- `base16` (default): Base16
- `xresources`: Xresources terminal colors
- `-n name`, `-a author`: Set the scheme and author name.
- `--hsl`: Treat the background color as being gamma-encoded HSL (i.e. what most people are used to). Wouldn't recommend it, but if it works for you...
2021-12-09 17:23:12 -05:00
- `-e`: Equiluminant mode; uses the same luminance for the hues. This keeps their brightness uniform but can make them harder to tell apart.
- `-b amount`: Make the hue colors blend with the background's hue. 0.0 (default) 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.
- `-c contrast`: Desired contrast ratio between the foreground and background colors. Default is 7. 21 guarantees the highest possible contrast (i.e. the foreground will either be white or black).
2021-12-09 17:23:12 -05:00
- Base16 options:
- `-l`: Don't darken the last color (brown).
## Notes
### On luminance options
2021-12-09 17:23:12 -05:00
The only good ranges for background luminance at the moment are 0.00 to 0.10 and 0.31 to 1.00. It's at these ranges that the script can maintain its contrast levels; anything between 0.11 to 0.30, and the foreground color will start losing contrast with the background. In addition, the contrast with the hues break down the closer you get to 0.30.
2021-12-09 17:23:12 -05:00
tl;dr: Don't set the background luminance between (0.10, 0.30] unless you like eyesores.