Skip to content

Commit

Permalink
Rewrite colors into shortest possible name
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
nthykier committed Feb 23, 2021
1 parent 7a83e71 commit 551c887
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 167 deletions.
Loading

0 comments on commit 551c887

Please sign in to comment.