diff --git a/src/config.py b/src/config.py index 53eb2ab..4b1a911 100644 --- a/src/config.py +++ b/src/config.py @@ -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): diff --git a/src/html_preprocessor.py b/src/html_preprocessor.py index 6ea1130..48a5baf 100644 --- a/src/html_preprocessor.py +++ b/src/html_preprocessor.py @@ -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: