Cleanup
This commit is contained in:
parent
b4c656770f
commit
004fa3690e
1 changed files with 30 additions and 61 deletions
|
|
@ -283,14 +283,11 @@ def make_style(state):
|
||||||
|
|
||||||
if color[0] == "g":
|
if color[0] == "g":
|
||||||
val = int(color[1:2])
|
val = int(color[1:2])
|
||||||
if val < 25:
|
if val < 25: result = "black"
|
||||||
result = "black"
|
elif val < 50: result = "dark gray"
|
||||||
elif val < 50:
|
elif val < 75: result = "light gray"
|
||||||
result = "dark gray"
|
else: result = "white"
|
||||||
elif val < 75:
|
|
||||||
result = "light gray"
|
|
||||||
else:
|
|
||||||
result = "white"
|
|
||||||
else:
|
else:
|
||||||
r = int(color[0], 16)
|
r = int(color[0], 16)
|
||||||
g = int(color[1], 16)
|
g = int(color[1], 16)
|
||||||
|
|
@ -298,65 +295,43 @@ def make_style(state):
|
||||||
|
|
||||||
if r == g == b:
|
if r == g == b:
|
||||||
val = int(color[0], 16)*6
|
val = int(color[0], 16)*6
|
||||||
if val < 12:
|
if val < 12: result = "black"
|
||||||
result = "black"
|
elif val < 50: result = "dark gray"
|
||||||
elif val < 50:
|
elif val < 80: result = "light gray"
|
||||||
result = "dark gray"
|
else: result = "white"
|
||||||
elif val < 80:
|
|
||||||
result = "light gray"
|
|
||||||
else:
|
|
||||||
result = "white"
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if r == b:
|
if r == b:
|
||||||
if r > g:
|
if r > g:
|
||||||
if r > t:
|
if r > t: result = "light magenta"
|
||||||
result = "light magenta"
|
else: result = "dark magenta"
|
||||||
else:
|
|
||||||
result = "dark magenta"
|
|
||||||
else:
|
else:
|
||||||
if g > t:
|
if g > t: result = "light green"
|
||||||
result = "light green"
|
else: result = "dark green"
|
||||||
else:
|
|
||||||
result = "dark green"
|
|
||||||
if b == g:
|
if b == g:
|
||||||
if b > r:
|
if b > r:
|
||||||
if b > t:
|
if b > t: result = "light cyan"
|
||||||
result = "light cyan"
|
else: result = "dark cyan"
|
||||||
else:
|
|
||||||
result = "dark cyan"
|
|
||||||
else:
|
else:
|
||||||
if r > t:
|
if r > t: result = "light red"
|
||||||
result = "light red"
|
else: result = "dark red"
|
||||||
else:
|
|
||||||
result = "dark red"
|
|
||||||
if g == r:
|
if g == r:
|
||||||
if g > b:
|
if g > b:
|
||||||
if g > t:
|
if g > t: result = "yellow"
|
||||||
result = "yellow"
|
else: result = "brown"
|
||||||
else:
|
|
||||||
result = "brown"
|
|
||||||
else:
|
else:
|
||||||
if b > t:
|
if b > t: result = "light blue"
|
||||||
result = "light blue"
|
else: result = "dark blue"
|
||||||
else:
|
|
||||||
result = "dark blue"
|
|
||||||
|
|
||||||
if r > g and r > b:
|
if r > g and r > b:
|
||||||
if r > t:
|
if r > t: result = "light red"
|
||||||
result = "light red"
|
else: result = "dark red"
|
||||||
else:
|
|
||||||
result = "dark red"
|
|
||||||
if g > r and g > b:
|
if g > r and g > b:
|
||||||
if g > t:
|
if g > t: result = "light green"
|
||||||
result = "light green"
|
else: result = "dark green"
|
||||||
else:
|
|
||||||
result = "dark green"
|
|
||||||
if b > g and b > r:
|
if b > g and b > r:
|
||||||
if b > t:
|
if b > t: result = "light blue"
|
||||||
result = "light blue"
|
else: result = "dark blue"
|
||||||
else:
|
|
||||||
result = "dark blue"
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
result = "default"
|
result = "default"
|
||||||
|
|
@ -422,12 +397,9 @@ def make_style(state):
|
||||||
bg = state["bg_color"]
|
bg = state["bg_color"]
|
||||||
|
|
||||||
format_string = ""
|
format_string = ""
|
||||||
if bold:
|
if bold: format_string += ",bold"
|
||||||
format_string += ",bold"
|
if underline: format_string += ",underline"
|
||||||
if underline:
|
if italic: format_string += ",italics"
|
||||||
format_string += ",underline"
|
|
||||||
if italic:
|
|
||||||
format_string += ",italics"
|
|
||||||
|
|
||||||
name = "micron_"+fg+"_"+bg+"_"+format_string
|
name = "micron_"+fg+"_"+bg+"_"+format_string
|
||||||
if not name in SYNTH_STYLES:
|
if not name in SYNTH_STYLES:
|
||||||
|
|
@ -488,13 +460,10 @@ def make_output(state, line, url_delegate, pre_escape=False):
|
||||||
state["align"] = state["default_align"]
|
state["align"] = state["default_align"]
|
||||||
elif c == "c":
|
elif c == "c":
|
||||||
if state["align"] != "center": state["align"] = "center"
|
if state["align"] != "center": state["align"] = "center"
|
||||||
# else: state["align"] = state["default_align"]
|
|
||||||
elif c == "l":
|
elif c == "l":
|
||||||
if state["align"] != "left": state["align"] = "left"
|
if state["align"] != "left": state["align"] = "left"
|
||||||
# else: state["align"] = state["default_align"]
|
|
||||||
elif c == "r":
|
elif c == "r":
|
||||||
if state["align"] != "right": state["align"] = "right"
|
if state["align"] != "right": state["align"] = "right"
|
||||||
# else: state["align"] = state["default_align"]
|
|
||||||
elif c == "a":
|
elif c == "a":
|
||||||
state["align"] = state["default_align"]
|
state["align"] = state["default_align"]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue