forked from LiveCarta/BookConverter
epub converter: fix color to all in hex
This commit is contained in:
@@ -10,7 +10,7 @@ from itertools import takewhile
|
||||
from logging import CRITICAL
|
||||
|
||||
from livecarta_config import LawCartaConfig
|
||||
from util.color_reader import str2color_name
|
||||
from util.color_reader import str2hex
|
||||
|
||||
cssutils.log.setLevel(CRITICAL)
|
||||
|
||||
@@ -94,8 +94,8 @@ to suit livecarta style convention.
|
||||
|
||||
|
||||
def get_bg_color(x):
|
||||
color = LawCartaConfig.HTML42LIVECARTA_COLORS.get(str2color_name(x), '')
|
||||
color = '' if color == 'white' else color
|
||||
color = str2hex(x)
|
||||
color = color if str2hex(x) not in ['#ffffff', '#fff'] else ''
|
||||
return color
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ LIVECARTA_STYLE_ATTRS_MAPPING = {
|
||||
'font': lambda x: '',
|
||||
'font-family': lambda x: LawCartaConfig.font_correspondence_table.get(x.capitalize()),
|
||||
'font-size': convert_font_size,
|
||||
'color': lambda x: LawCartaConfig.HTML42LIVECARTA_COLORS.get(str2color_name(x), ''),
|
||||
'color': str2hex,
|
||||
'background-color': get_bg_color,
|
||||
'background': get_bg_color,
|
||||
'border-top-width': lambda x: x if x != '0' else '',
|
||||
|
||||
Reference in New Issue
Block a user