Fix some corner cases in _transform_hint_color
This commit is contained in:
parent
eac30fc84b
commit
373eca1ad2
@ -300,16 +300,16 @@ def _transform_hint_color(val):
|
|||||||
if val.startswith('-webkit-gradient'):
|
if val.startswith('-webkit-gradient'):
|
||||||
pattern = re.compile(r'-webkit-gradient\(linear, left top, '
|
pattern = re.compile(r'-webkit-gradient\(linear, left top, '
|
||||||
r'left bottom, '
|
r'left bottom, '
|
||||||
r'color-stop\(0%, *(#[a-fA-F0-9]{3,6})\), '
|
r'color-stop\(0%, *([^)]*)\), '
|
||||||
r'color-stop\(100%, *(#[a-fA-F0-9]{3,6})\)')
|
r'color-stop\(100%, *([^)]*)\)\)')
|
||||||
|
|
||||||
match = pattern.match(val)
|
match = pattern.fullmatch(val)
|
||||||
if match:
|
if match:
|
||||||
log.config.debug('Color groups: {}'.format(match.groups()))
|
log.config.debug('Color groups: {}'.format(match.groups()))
|
||||||
start_color = QColor(match.group(1))
|
start_color = QColor(match.group(1))
|
||||||
stop_color = QColor(match.group(2))
|
stop_color = QColor(match.group(2))
|
||||||
qtutils.ensure_valid(start_color)
|
if not start_color.isValid() or not stop_color.isValid():
|
||||||
qtutils.ensure_valid(stop_color)
|
return None
|
||||||
|
|
||||||
return ('qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 {}, '
|
return ('qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 {}, '
|
||||||
'stop:1 {})'.format(to_rgba(start_color),
|
'stop:1 {})'.format(to_rgba(start_color),
|
||||||
|
Loading…
Reference in New Issue
Block a user