scour/unittests/color-formats.svg
Niels Thykier 551c88754e
Rewrite colors into shortest possible name
Improve the code for rewriting colors into recognising that some
colors are shorter by name.  This commit enables scour to rewrite
`rgb(255, 0, 0)` into `red` which is slightly shorter than `#f00`
(ditto for `tan` and `pink`).

When the color name ties in length with the hexcode, then scour will
leave it as-is if the input file used a variant of same length
(e.g. `blue`, `cyan` and `aqua` will be left as-is).  But if scour is
rewriting the color code, it will prefer the hex code variant.

Signed-off-by: Niels Thykier <niels@thykier.net>
2021-02-23 19:07:57 +00:00

14 lines
768 B
XML