Commit graph

3 commits

Author SHA1 Message Date
Niels Thykier
a3c4aa86d9
convertColor: Correctly shorten #FF0000 (upper case) to red
Signed-off-by: Niels Thykier <niels@thykier.net>
2021-02-23 19:49:53 +00:00
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
Eduard Braun
3b7e8a0091 Restore unittests from history 2015-12-06 19:59:06 +01:00