Friday, 5 March 2021

Colour Names 5

Still more colour naming experiments...

My experiments with HWB-51 last time divided up the whiteness-blackness plane for a particular hue (e.g. blue) like this:

Partitioning the whiteness-blackness plane in HWB-51

It can be seen that the partitioning doesn't occur in native whiteness-blackness space. Here's the relevant JavaScript pseudo-code:

var hwb_w = Math.min(linear_r, linear_g, linear_b);
var hwb_b = 1 - Math.max(linear_r, linear_g, linear_b);
var p = hwb_w + hwb_b;
var q = hwb_w / p;
if (p < 0.125) {
  return "vivid " + name;
}
if (p < 0.375) {
  return name;
}
if (p >= 0.875) {
  return achromatic(q);
}
...

Above, "p" is the Manhattan distance from the vivid corner; a measure of "achromicity". And "q" is a measure of how much of the "achromicity" is white, as opposed to black.

We compare this with the computation of HSV saturation and value parameters:

var hsv_v = Math.max(linear_r, linear_g, linear_b);
var chroma = hsv_v - Math.min(linear_r, linear_g, linear_b);
var hsv_s = (hsv_v > 0) ? (chroma / hsv_v) : 0;
...

We see that there are obvious similarities:

p == 1 - chroma
  == 1 - hsv_s * hsv_v

and 

q == (hsv_v - chroma) / (1 - chroma)
  == hsv_v * (1 - hsv_s) / (1 - hsv_s * hsv_v)

This shouldn't be a complete surprise as Smith and Lyons themselves noted that the "HWB model is very closely related to the HSV model". So we could quite simply reformulate the HWB-51 rules to use HSV or, indeed, HSL.

However, one of the reasons for the creation of HWB in 1995 was to have a "more intuitive hue-based color model" and I quite like the symmetry in the whiteness-blackness plane:

  • Adding whiteness creates a tint (baselightpale → white)
  • Adding blackness creates a shade (base → dark → deep → black)
  • Adding both creates a tone (base → dull → grey)
So describing the HWB-51 and HWB-91 colour naming schemes with reference to the HWB colour space may be useful to end users.

NOTE: Don't forget that HWB assumes that red, green and blue channels are linear. So sRGB values need linearizing, that is [and this was a new phrase for me] "inverse companding".

No comments:

Post a comment