Allow specifying arbitrary colors as hex triplets when creating custom columns with a fixed set of values. Fixes #1302078 [Allowing RGB colors for custom columns](https://bugs.launchpad.net/calibre/+bug/1302078)

This commit is contained in:
Stephan Hradek 2014-04-03 19:12:51 +02:00 committed by Kovid Goyal
parent fce3f56826
commit f6a6ab51c5

View File

@ -297,7 +297,7 @@ class CreateCustomColumn(QDialog, Ui_QCreateCustomColumn):
return self.simple_error('', _('The colors box must be empty or '
'contain the same number of items as the value box'))
for tc in c:
if tc not in QColor.colorNames():
if tc not in QColor.colorNames() and not re.match("#(?:[0-9a-f]{3}){1,4}",tc,re.I):
return self.simple_error('',
_('The color {0} is unknown').format(tc))