Catch QColors passed to ColorDict
This commit is contained in:
parent
7a6e2b3242
commit
cd8bca7e3b
@ -26,6 +26,8 @@ Module attributes:
|
|||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
from PyQt5.QtGui import QColor
|
||||||
|
|
||||||
import qutebrowser.config.config as config
|
import qutebrowser.config.config as config
|
||||||
from qutebrowser.utils.log import style as logger
|
from qutebrowser.utils.log import style as logger
|
||||||
|
|
||||||
@ -107,6 +109,11 @@ class ColorDict(dict):
|
|||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
logger.warning(e)
|
logger.warning(e)
|
||||||
return ''
|
return ''
|
||||||
|
if isinstance(val, QColor):
|
||||||
|
# This could happen when accidentaly declarding something as
|
||||||
|
# QtColor instead of Color in the config, and it'd go unnoticed as
|
||||||
|
# the CSS is invalid then.
|
||||||
|
raise TypeError("QColor passed to ColorDict!")
|
||||||
if 'fg' in key.split('.'):
|
if 'fg' in key.split('.'):
|
||||||
return 'color: {};'.format(val)
|
return 'color: {};'.format(val)
|
||||||
elif 'bg' in key.split('.'):
|
elif 'bg' in key.split('.'):
|
||||||
|
Loading…
Reference in New Issue
Block a user