Add CssColor conftype
This commit is contained in:
parent
0bbd128fca
commit
1f66766e0a
@ -302,7 +302,23 @@ class Command(BaseType):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Color(BaseType):
|
class CssColor(BaseType):
|
||||||
|
|
||||||
|
"""Base class for a CSS color value."""
|
||||||
|
|
||||||
|
typestr = 'css-color'
|
||||||
|
|
||||||
|
def validate(self, value):
|
||||||
|
if value.startswith('-'):
|
||||||
|
# custom function name, won't validate.
|
||||||
|
return
|
||||||
|
if QColor.isValidColor(value):
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise ValidationError(value, "must be a valid CSS color")
|
||||||
|
|
||||||
|
|
||||||
|
class Color(CssColor):
|
||||||
|
|
||||||
"""Base class for a color value.
|
"""Base class for a color value.
|
||||||
|
|
||||||
@ -318,10 +334,7 @@ class Color(BaseType):
|
|||||||
if any([value.startswith(start) for start in Color._GRADIENTS]):
|
if any([value.startswith(start) for start in Color._GRADIENTS]):
|
||||||
# We can't validate this further.
|
# We can't validate this further.
|
||||||
return
|
return
|
||||||
if QColor.isValidColor(value):
|
super().validate(value)
|
||||||
pass
|
|
||||||
else:
|
|
||||||
raise ValidationError(value, "must be a valid color")
|
|
||||||
|
|
||||||
|
|
||||||
class Font(BaseType):
|
class Font(BaseType):
|
||||||
|
Loading…
Reference in New Issue
Block a user