fix colors in converter

This commit is contained in:
shirshasa
2020-10-22 14:50:39 +03:00
parent adb9b17500
commit cadb5a6e56
2 changed files with 18 additions and 2 deletions

View File

@@ -72,6 +72,22 @@ class LawCartaConfig:
"Verdana": "verdana,geneva,sans-serif"
}
COLORS = {
'#ffff00': 'yellow',
'#00ff00': 'darkYellow',
'#00ffff': 'cyan',
'#ff00ff': 'magenta',
'#0000ff': 'blue',
'#ff0000': 'red',
'#000080': 'darkBlue',
'#008080': 'darkCyan',
'#008000': 'green',
'#800080': 'darkMagenta',
'#808000': 'darkGreen',
'#c0c0c0': 'lightGray',
'#ffffff': 'white',
}
class BookApiWrapper:
def __init__(self, access, logger_object, book_id=0):

View File

@@ -91,10 +91,10 @@ class HTMLPreprocessor:
if style:
style = self.convert_font_pt_to_px(style)
if style != "":
if color and color != '#000000':
if color and color in LawCartaConfig.COLORS:
style += f'; color: {color};'
font.attrs["style"] = style
elif color and color != '#000000':
elif color and color in LawCartaConfig.COLORS:
font.attrs["style"] = f'color: {color};'
if face is not None: