Skip to content

Commit 3baf77d

Browse files
committed
feat: use proper nf-weather and nf-fa icons for moon, temp, AQI
- Moon phases: nf-weather-moon_* (e38d-e3a5) - Moonrise/moonset: nf-weather-moonrise/moonset (e3c1/e3c2) - Temperature: nf-fa-temperature_* adaptive to temp range - AQI: nf-md-air_filter (f0d43)
1 parent 9b2dec5 commit 3baf77d

3 files changed

Lines changed: 32 additions & 16 deletions

File tree

src/display/compact.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn render(loc: &Location, weather: &WeatherResponse, air: &Option<AirQuality
1919
" {} {} {}",
2020
desc.white(),
2121
"·".dimmed(),
22-
format!("Feels like {:.0}°", cur.apparent_temperature).dimmed()
22+
format!("{} Feels like {:.0}°", temp_icon(cur.apparent_temperature), cur.apparent_temperature).dimmed()
2323
);
2424
let today_rain = daily
2525
.precipitation_probability_max
@@ -150,8 +150,8 @@ pub fn render(loc: &Location, weather: &WeatherResponse, air: &Option<AirQuality
150150
moon_icon(phase).truecolor(200, 200, 220),
151151
format!("{phase} {illum}%").dimmed(),
152152
"".dimmed(),
153-
format!("{mrise}").dimmed(),
154-
format!("{mset}").dimmed(),
153+
format!("\u{e3c1} {mrise}").dimmed(),
154+
format!("\u{e3c2} {mset}").dimmed(),
155155
);
156156
}
157157
}

src/display/full.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn render(loc: &Location, weather: &WeatherResponse, air: &Option<AirQuality
2020
" {} {} {}",
2121
desc.white(),
2222
"·".dimmed(),
23-
format!("Feels like {:.0}°", cur.apparent_temperature).dimmed()
23+
format!("{} Feels like {:.0}°", temp_icon(cur.apparent_temperature), cur.apparent_temperature).dimmed()
2424
);
2525
let today_rain = daily
2626
.precipitation_probability_max
@@ -237,8 +237,8 @@ pub fn render(loc: &Location, weather: &WeatherResponse, air: &Option<AirQuality
237237
moon_icon(phase).truecolor(200, 200, 220),
238238
format!("{phase} {illum}%").dimmed(),
239239
"".dimmed(),
240-
format!("{mrise}").dimmed(),
241-
format!("{mset}").dimmed(),
240+
format!("\u{e3c1} {mrise}").dimmed(),
241+
format!("\u{e3c2} {mset}").dimmed(),
242242
);
243243
}
244244
}

src/display/mod.rs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,37 @@ pub(crate) const ICON_SUNRISE: &str = "\u{f059c}";
8181
pub(crate) const ICON_SUNSET: &str = "\u{f059b}";
8282
pub(crate) const ICON_DROP: &str = "\u{f043}";
8383
pub(crate) const ICON_GAUGE: &str = "\u{f0241}";
84-
pub(crate) const ICON_LEAF: &str = "\u{f0312}";
84+
pub(crate) const ICON_LEAF: &str = "\u{f0d43}";
8585
pub(crate) const ICON_EYE: &str = "\u{f06e}";
8686
pub(crate) const ICON_NIGHT_CLOUDY: &str = "\u{f0f31}";
8787

88+
pub(crate) fn temp_icon(temp: f64) -> &'static str {
89+
if temp >= 35.0 {
90+
"\u{ef2a}" // high
91+
} else if temp >= 25.0 {
92+
"\u{f2c7}" // full
93+
} else if temp >= 15.0 {
94+
"\u{f2c8}" // three-quarters
95+
} else if temp >= 5.0 {
96+
"\u{f2c9}" // half
97+
} else if temp >= -5.0 {
98+
"\u{f2ca}" // quarter
99+
} else {
100+
"\u{f2cb}" // empty
101+
}
102+
}
103+
88104
pub(crate) fn moon_icon(phase: &str) -> &'static str {
89105
match phase {
90-
"New Moon" => "\u{f0b75}",
91-
"Waxing Crescent" => "\u{f0b72}",
92-
"First Quarter" => "\u{f0b71}",
93-
"Waxing Gibbous" => "\u{f0b70}",
94-
"Full Moon" => "\u{f0b6f}",
95-
"Waning Gibbous" => "\u{f0b74}",
96-
"Last Quarter" => "\u{f0b73}",
97-
"Waning Crescent" => "\u{f0b76}",
98-
_ => "\u{f0b75}",
106+
"New Moon" => "\u{e38d}",
107+
"Waxing Crescent" => "\u{e391}",
108+
"First Quarter" => "\u{e394}",
109+
"Waxing Gibbous" => "\u{e398}",
110+
"Full Moon" => "\u{e39b}",
111+
"Waning Gibbous" => "\u{e39e}",
112+
"Last Quarter" => "\u{e3a2}",
113+
"Waning Crescent" => "\u{e3a5}",
114+
_ => "\u{e38d}",
99115
}
100116
}
101117

0 commit comments

Comments
 (0)