mirror of
https://github.com/chubin/wttr.in
synced 2024-11-15 08:37:12 +00:00
v2: use different color for captions
This commit is contained in:
parent
a3bf070bb3
commit
a284ff9de4
1 changed files with 6 additions and 4 deletions
10
lib/spark.py
10
lib/spark.py
|
@ -486,8 +486,10 @@ def textual_information(data_parsed, geo_data, config):
|
|||
% str(sun['sunset'].strftime("%H:%M:%S")))
|
||||
tmp_output.append('Dusk: %s'
|
||||
% str(sun['dusk'].strftime("%H:%M:%S")))
|
||||
|
||||
color_code = "38;5;246"
|
||||
tmp_output = [
|
||||
re.sub("^([A-Za-z]*:)", lambda m: colorize(m.group(1), "2"), x)
|
||||
re.sub("^([A-Za-z]*:)", lambda m: colorize(m.group(1), color_code), x)
|
||||
for x in tmp_output]
|
||||
|
||||
output.append(
|
||||
|
@ -515,9 +517,9 @@ def textual_information(data_parsed, geo_data, config):
|
|||
))
|
||||
|
||||
output = [
|
||||
re.sub("^( *[A-Za-z]*:)", lambda m: colorize(m.group(1), "2"),
|
||||
re.sub("^( +[A-Za-z]*:)", lambda m: colorize(m.group(1), "2"),
|
||||
re.sub(r"(\|)", lambda m: colorize(m.group(1), "2"), x)))
|
||||
re.sub("^( *[A-Za-z]*:)", lambda m: colorize(m.group(1), color_code),
|
||||
re.sub("^( +[A-Za-z]*:)", lambda m: colorize(m.group(1), color_code),
|
||||
re.sub(r"(\|)", lambda m: colorize(m.group(1), color_code), x)))
|
||||
for x in output]
|
||||
|
||||
return "".join("%s\n" % x for x in output)
|
||||
|
|
Loading…
Reference in a new issue