• Bram Schoenmakers's avatar
    Introduce a Color class · 163fdb91
    Bram Schoenmakers authored
    This color class abstracts away all the possible representations of a
    color in various UIs. These are color objects:
    
    Color(9)              # red
    Color('red')          # red
    Color(196)            # red
    Color('NEUTRAL')      # neutral (resets attributes)
    Color()               # no effect
    
    The configuration stores Color objects now, code that requires colors
    doesn't have to worry about integer representations of colors.
    
    One semantic change: when an empty color is passed as a priority color,
    it will resort to an empty color instead of the neutral color. In
    practice this should have the same visual effect. Test case
    test_priority_color4 is adapted for this.
    
    This commit is the result after an initial refactoring of the color code
    (squashed its history into this one). @mruwek also contributed to this
    refactoring, thanks for the help and the ideas to get to this point.
    163fdb91
test_colors.py 8.78 KB