Fix error in color setting detection
Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
parent
32007368c5
commit
b5ffd0d716
@ -109,9 +109,9 @@ def decodeTextStyle(text: str) -> dict:
|
||||
if len(field) != 10:
|
||||
return dict()
|
||||
|
||||
if field[0]:
|
||||
if field[0] and len(field[0]) == 8:
|
||||
style["text-color"] = reEcodeColors(field[0])
|
||||
if field[1]:
|
||||
if field[1] and len(field[1]) == 8:
|
||||
style["selected-text-color"] = reEcodeColors(field[1])
|
||||
if field[2]:
|
||||
style["bold"] = reEncodeBool(field[2])
|
||||
@ -121,9 +121,9 @@ def decodeTextStyle(text: str) -> dict:
|
||||
style["strike-through"] = reEncodeBool(field[4])
|
||||
if field[5]:
|
||||
style["underline"] = reEncodeBool(field[5])
|
||||
if field[6]:
|
||||
if field[6] and len(field[6]) == 8:
|
||||
style["background-color"] = reEcodeColors(field[6])
|
||||
if field[7]:
|
||||
if field[7] and len(field[7]) == 8:
|
||||
style["selected-text-color"] = reEcodeColors(field[7])
|
||||
# 8: font family > ignored
|
||||
# 9: --- > ignored
|
||||
@ -162,6 +162,22 @@ def extractTextStyles(section: dict) -> dict:
|
||||
return text_styles
|
||||
|
||||
|
||||
def extractCustomStyles() -> dict:
|
||||
custom_styles = {}
|
||||
|
||||
key: str
|
||||
value: str
|
||||
for key, value in normalizedSections.items():
|
||||
if not key.startswith("Highlighting"):
|
||||
continue
|
||||
|
||||
realKey = key[len("Highlighting "):]
|
||||
|
||||
|
||||
|
||||
return custom_styles
|
||||
|
||||
|
||||
config = ConfigParser(delimiters="=")
|
||||
config.optionxform = str
|
||||
config.read('DarkOxygen.kateschema')
|
||||
@ -173,5 +189,8 @@ if "Editor Colors" in normalizedSections:
|
||||
if "Default Item Styles" in normalizedSections:
|
||||
jsonConfig["text-styles"] = extractTextStyles(config[normalizedSections["Default Item Styles"]])
|
||||
|
||||
jsonConfig["custom-styles"] = extractCustomStyles()
|
||||
|
||||
|
||||
pprint(jsonConfig)
|
||||
# pprint(config.sections())
|
||||
|
Loading…
Reference in New Issue
Block a user