Add color named to dict with data

This commit is contained in:
DarkPhoenix
2019-08-06 13:08:19 +03:00
parent eb87ba1d89
commit e2d6baaeb1
2 changed files with 13 additions and 10 deletions

View File

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

View File

@@ -42,7 +42,7 @@ class LineColor(ViewColumn):
color_data = BASE_COLORS[stuff.color]
except KeyError:
return -1
img = self.fittingView.imageList.GetImageIndex(color_data[1], 'gui')
img = self.fittingView.imageList.GetImageIndex(color_data.iconName, 'gui')
return img
return -1