Soft / xcolor

Lightweight color picker for X11
https://soft.github.io/xcolor/
MIT License
460 stars 23 forks source link

Different color function outputs #40

Open japorized opened 2 years ago

japorized commented 2 years ago

Hello and thank you all for this amazing tool.

I was wondering if there's an interest in adding different color function outputs (particularly for HSL, for now). I was thinking of making a PR, but I wasn't certain if that fits within the vision of its maintainers.

In terms of implementation, I was thinking of performing a conversion from RGB, right before printing the output. However, and I'm not familiar with the problems in color conversions, conversions may be lossy (e.g. RGB to HSL). To make things worse, HSL, for example, uses decimals, i.e floating point math, which is

  1. difficult for accuracy
  2. adds complexity to testing

What do you all think? Is it worth pursuing?

N-R-K commented 2 years ago

To make things worse, HSL, for example, uses decimals, i.e floating point math

Most HSL picker/wheel I see don't allow for decimals because no one really cares about 8.0 vs 8.4. It should be possible to use 32bit integers to convert rgb to HSL with a margin of error of 0.5.