| 31 | |
| 32 | |
| 33 | class LineStyleData: |
| 34 | |
| 35 | def __init__(self, name, iconNamePrefix, mplSpec): |
| 36 | self.name = name |
| 37 | self._iconNamePrefix = iconNamePrefix |
| 38 | self.mplSpec = mplSpec |
| 39 | |
| 40 | @property |
| 41 | def iconName(self): |
| 42 | # Get lightness out of RGB color, see following link for math: |
| 43 | # https://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/ |
| 44 | r, g, b, a = (c / 255 for c in wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)) |
| 45 | l = (max(r, g, b) + min (r, g, b)) / 2 |
| 46 | suffix = '_black' if l > 0.3 else '_white' |
| 47 | return '{}{}'.format(self._iconNamePrefix, suffix) |
| 48 | |
| 49 | |
| 50 | # In HSL format |