mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-26 04:51:08 -05:00
NuWeather: update temperature colour scheme
This commit is contained in:
parent
4e132d708c
commit
31c97a646b
@ -84,22 +84,22 @@ def format_temp(displaymode, f=None, c=None):
|
|||||||
c = (f - 32) * 5/9
|
c = (f - 32) * 5/9
|
||||||
|
|
||||||
f = float(f)
|
f = float(f)
|
||||||
if f < 10:
|
# Roughly inspired by https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/a-meaningful-temperature-palette/
|
||||||
color = 'light blue'
|
if f > 100:
|
||||||
elif f < 32:
|
color = '4' # red
|
||||||
color = 'teal'
|
elif f > 85:
|
||||||
elif f < 50:
|
color = '7' # orange
|
||||||
color = 'blue'
|
elif f > 75:
|
||||||
elif f < 60:
|
color = '8' # yellow
|
||||||
color = 'light green'
|
elif f > 60:
|
||||||
elif f < 70:
|
color = '9' # light green
|
||||||
color = 'green'
|
elif f > 40:
|
||||||
elif f < 80:
|
color = '11' # cyan
|
||||||
color = 'yellow'
|
elif f > 10:
|
||||||
elif f < 90:
|
color = '12' # light blue
|
||||||
color = 'orange'
|
|
||||||
else:
|
else:
|
||||||
color = 'red'
|
color = '15' # light grey
|
||||||
|
|
||||||
# Show temp values to one decimal place
|
# Show temp values to one decimal place
|
||||||
c = '%.1f' % c
|
c = '%.1f' % c
|
||||||
f = '%.1f' % f
|
f = '%.1f' % f
|
||||||
@ -114,7 +114,7 @@ def format_temp(displaymode, f=None, c=None):
|
|||||||
s = '%sC' % c
|
s = '%sC' % c
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unknown display mode for temperature.")
|
raise ValueError("Unknown display mode for temperature.")
|
||||||
return ircutils.mircColor(s, color)
|
return f'\x03{color.zfill(2)}{s}\x03'
|
||||||
|
|
||||||
def wind_direction(angle):
|
def wind_direction(angle):
|
||||||
"""Returns wind direction (N, W, S, E, etc.) given an angle."""
|
"""Returns wind direction (N, W, S, E, etc.) given an angle."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user