From 298553d48d21e0c15d8a0b9836d461e0b17b4132 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 13 Jun 2017 14:44:20 +0200 Subject: [PATCH] Fix QssColor --- qutebrowser/config/configtypes.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index d114904a3..e90b31911 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -690,23 +690,26 @@ class QtColor(BaseType): raise configexc.ValidationError(value, "must be a valid color") -class QssColor(QtColor): +class QssColor(BaseType): """Color used in a Qt stylesheet.""" def from_py(self, value): - functions = ['rgb', 'rgba', 'hsv', 'hsva', 'qlineargradient', - 'qradialgradient', 'qconicalgradient'] self._basic_validation(value, pytype=str) if not value: return None + functions = ['rgb', 'rgba', 'hsv', 'hsva', 'qlineargradient', + 'qradialgradient', 'qconicalgradient'] if (any(value.startswith(func + '(') for func in functions) and value.endswith(')')): # QColor doesn't handle these return value - return super().from_py(value) + if not QColor.isValidColor(value): + raise configexc.ValidationError(value, "must be a valid color") + + return value class Font(BaseType):