add range slider component

This commit is contained in:
2022-12-01 17:48:05 +01:00
parent 32c7da6ee5
commit e8f9e140fd
3 changed files with 176 additions and 12 deletions

18
src/util/color.py Normal file
View File

@@ -0,0 +1,18 @@
import re
from PySide6.QtGui import QColor
def is_hex_color(color: str):
return re.match("[0-9a-f]{6}", 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)
elif color in QColor().colorNames():
return QColor(color)
return QColor(255, 255, 255)