Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite colors into shortest possible name #270

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Feb 23, 2021

  1. 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>
    nthykier committed Feb 23, 2021
    Configuration menu
    Copy the full SHA
    551c887 View commit details
    Browse the repository at this point in the history
  2. Add --disable-shorten-colors cmd line option

    It replaces `--disable-simplify-colors` (although the old name is
    still accepted).
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
    nthykier committed Feb 23, 2021
    Configuration menu
    Copy the full SHA
    7879ecb View commit details
    Browse the repository at this point in the history
  3. Always normalize the color name when shortening colors

    This enables scour to consistently perform other optimizations that
    rely on string equality to determine if two attributes are identical.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
    nthykier committed Feb 23, 2021
    Configuration menu
    Copy the full SHA
    ce92515 View commit details
    Browse the repository at this point in the history
  4. convertColor: Correctly shorten #FF0000 (upper case) to red

    Signed-off-by: Niels Thykier <niels@thykier.net>
    nthykier committed Feb 23, 2021
    Configuration menu
    Copy the full SHA
    a3c4aa8 View commit details
    Browse the repository at this point in the history
  5. Fix flake8 error

    Signed-off-by: Niels Thykier <niels@thykier.net>
    nthykier committed Feb 23, 2021
    Configuration menu
    Copy the full SHA
    0c77c27 View commit details
    Browse the repository at this point in the history