Browse Source

wait how long has this been like this

master
whut 1 year ago
parent
commit
abaddd3d2f
2 changed files with 7 additions and 2 deletions
  1. +6
    -1
      README.md
  2. +1
    -1
      acid16.py

+ 6
- 1
README.md View File

@@ -1,7 +1,7 @@
# acid16
It makes color schemes. Pass a background color, an accent color, and optionally a foreground text color, and out comes a color scheme.

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.
The program uses a quasi-[HCL](https://en.wikipedia.org/wiki/HCL_color_space) color model (see "The color model itself"). 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 here 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.

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").

@@ -49,3 +49,8 @@ Here's the preview it'd generate:
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.

tl;dr: Don't set the background luminance between (0.10, 0.30] unless you like eyesores.

### The color model itself
It's not HSL, it's not HSV, or LCH, or HCL, or really any of it (or maybe it is, but I'm not color-theory-literate enough to know). If anything it's basically HSL except with these changes:
1. Linear color ramping instead of sRGB gamma encoding. Internally this doesn't matter until it's time to actually display the color.
2. Whereas HSL gives you the pure color at 100% S and 50% L (and starts to blend it with white as you drive L up from there), this model gives you the pure color at a luminance dependent on the hue itself. So for instance, pure red (RGB 100%, 0%, 0%; or HSL 0°, 100%, 50%) has a luminance of about 0.2126. The equivalent in acid16's model is `0.0,1.0,0.2126`. As you raise luminance past that value, the color will approach white.

+ 1
- 1
acid16.py View File

@@ -21,7 +21,7 @@ parser.add_option("-B", "--hue-blend-target",
action="store",
dest="hueBlendTarget",
default="background",
help="mix ratio between hues and background")
help="what to blend the hues with: background (default), foreground, accent")
parser.add_option("-c", "--contrast",
action="store",
dest="foreContrast",


Loading…
Cancel
Save