Rework dict with color data to use color enum

This commit is contained in:
DarkPhoenix
2019-08-06 12:44:59 +03:00
parent 16f4903eba
commit 70d1a3534b
2 changed files with 25 additions and 9 deletions

View File

@@ -18,16 +18,21 @@
# =============================================================================
from collections import OrderedDict
from service.const import Color
# In HSL format
BASE_COLORS = (
(0 / 360.0, 1.0, 0.5, 'Red'),
(120 / 360.0, 1.0, 0.5, 'Green'),
(240 / 360.0, 1.0, 0.5, 'Blue'),
(56 / 360.0, 1.0, 0.5, 'Yellow'),
(180 / 360.0, 1.0, 0.5, 'Cyan'),
(300 / 360.0, 1.0, 0.5, 'Magenta'),
(40 / 360.0, 1.0, 0.5, 'Orange'),
(275 / 360.0, 1.0, 0.5, 'Purple'))
BASE_COLORS = OrderedDict([
(Color.red, (0 / 360.0, 1.0, 0.5, 'color_red')),
(Color.green, (120 / 360.0, 1.0, 0.5, 'color_green')),
(Color.blue, (240 / 360.0, 1.0, 0.5, 'color_blue')),
(Color.yellow, (56 / 360.0, 1.0, 0.5, 'color_yellow')),
(Color.cyan, (180 / 360.0, 1.0, 0.5, 'color_cyan')),
(Color.magenta, (300 / 360.0, 1.0, 0.5, 'color_magenta')),
(Color.orange, (40 / 360.0, 1.0, 0.5, 'color_orange')),
(Color.purple, (275 / 360.0, 1.0, 0.5, 'color_purple'))])
def hsl_to_hsv(hsl):

View File

@@ -138,3 +138,14 @@ class TargetResistMode(IntEnum):
armor = autoId()
hull = autoId()
weightedAverage = autoId()
@unique
class Color(IntEnum):
red = autoId()
green = autoId()
blue = autoId()
yellow = autoId()
cyan = autoId()
magenta = autoId()
orange = autoId()
purple = autoId()