forked from LiveCarta/BookConverter
fix colors in converter
This commit is contained in:
@@ -72,6 +72,22 @@ class LawCartaConfig:
|
|||||||
"Verdana": "verdana,geneva,sans-serif"
|
"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:
|
class BookApiWrapper:
|
||||||
def __init__(self, access, logger_object, book_id=0):
|
def __init__(self, access, logger_object, book_id=0):
|
||||||
|
|||||||
@@ -91,10 +91,10 @@ class HTMLPreprocessor:
|
|||||||
if style:
|
if style:
|
||||||
style = self.convert_font_pt_to_px(style)
|
style = self.convert_font_pt_to_px(style)
|
||||||
if style != "":
|
if style != "":
|
||||||
if color and color != '#000000':
|
if color and color in LawCartaConfig.COLORS:
|
||||||
style += f'; color: {color};'
|
style += f'; color: {color};'
|
||||||
font.attrs["style"] = style
|
font.attrs["style"] = style
|
||||||
elif color and color != '#000000':
|
elif color and color in LawCartaConfig.COLORS:
|
||||||
font.attrs["style"] = f'color: {color};'
|
font.attrs["style"] = f'color: {color};'
|
||||||
|
|
||||||
if face is not None:
|
if face is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user