add positions of hits to the range slider
This commit is contained in:
@@ -7,12 +7,22 @@ def is_hex_color(color: str):
|
||||
return re.match("[0-9a-f]{6}", color, flags=re.IGNORECASE)
|
||||
|
||||
|
||||
def is_hex_color_with_alpha(color: str):
|
||||
return re.match("[0-9a-f]{8}", color, flags=re.IGNORECASE)
|
||||
|
||||
|
||||
def to_qcolor(color: str):
|
||||
if is_hex_color(color):
|
||||
red = int(color[0:2], 16)
|
||||
green = int(color[2:4], 16)
|
||||
blue = int(color[4:6], 16)
|
||||
return QColor(red, green, blue)
|
||||
if is_hex_color_with_alpha(color):
|
||||
red = int(color[0:2], 16)
|
||||
green = int(color[2:4], 16)
|
||||
blue = int(color[4:6], 16)
|
||||
alpha = int(color[6:8], 16)
|
||||
return QColor(red, green, blue, alpha)
|
||||
elif color in QColor().colorNames():
|
||||
return QColor(color)
|
||||
return QColor(255, 255, 255)
|
||||
|
||||
Reference in New Issue
Block a user