statusweather: Add night symbols, change some symbols.
The only day→night change at the moment is for clear sky.
This commit is contained in:
parent
5356547d49
commit
1a2aa46ba2
|
@ -36,6 +36,7 @@
|
|||
#include <string_view>
|
||||
#include <thread>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
struct weather
|
||||
{
|
||||
|
@ -48,22 +49,28 @@ std::mutex mutex_weather;
|
|||
std::string map_icon(const std::string_view icon_id)
|
||||
{
|
||||
// <https://openweathermap.org/weather-conditions>
|
||||
const std::map<std::uint8_t, std::string> icons{{{1, "🌞"},
|
||||
{2, "⛅"},
|
||||
{3, "☁"},
|
||||
{4, "☁"},
|
||||
{9, "🌧"},
|
||||
{10, "🌧"},
|
||||
{10, "⛈"},
|
||||
{13, "🌨"},
|
||||
{50, "🌫"}}};
|
||||
// TODO: Differenciate between day and night.
|
||||
// NOTE: There does not seem to be weather emojis with the moon in unicode.
|
||||
const std::map<std::uint8_t, std::pair<std::string, std::string>> icons{
|
||||
{{1, {"🌞", "🌝"}}, // clear sky
|
||||
{2, {"🌤", "🌤"}}, // few clouds
|
||||
{3, {"⛅", "⛅"}}, // scattered clouds
|
||||
{4, {"☁", "☁"}}, // broken clouds
|
||||
{9, {"🌧", "🌧"}}, // shower rain
|
||||
{10, {"🌧", "🌧"}}, // rain
|
||||
{10, {"🌩", "🌩"}}, // thunderstorm
|
||||
{13, {"🌨", "🌨"}}, // snow
|
||||
{50, {"🌫", "🌫"}}}}; // mist
|
||||
const auto icon{icons.find(std::stoul(icon_id.data()))};
|
||||
|
||||
if (icon != icons.end())
|
||||
{
|
||||
return icon->second;
|
||||
if (*icon_id.rbegin() == 'n') // Night
|
||||
{
|
||||
return icon->second.second;
|
||||
}
|
||||
return icon->second.first;
|
||||
}
|
||||
return {};
|
||||
return "❔";
|
||||
}
|
||||
|
||||
std::tuple<std::string, std::string> get_options()
|
||||
|
|
Loading…
Reference in New Issue
Block a user