MCPcopy Create free account
hub / github.com/ajatkj/scriptable / getWeatherSymbol

Function getWeatherSymbol

LSWeather.js:846–897  ·  view source on GitHub ↗
(weatherID, isNight)

Source from the content-addressed store, hash-verified

844FUNCTION getWeatherSymbol
845------------------------------------------------------------------*/
846function getWeatherSymbol(weatherID, isNight){
847 // Check all weather IDs at https://openweathermap.org/weather-conditions#Weather-Condition-Codes-2
848 if (weatherID >= 200 && weatherID <= 211){
849 if (isNight) return "cloud.moon.bolt.fill";
850 else return "cloud.sun.bolt.fill";
851 } else if (weatherID > 211 && weatherID <= 232){
852 if (isNight) return "cloud.bolt.rain.fill";
853 else return "cloud.bolt.rain.fill";
854 } else if (weatherID >= 300 && weatherID <= 311) {
855 if (isNight) return "cloud.drizzle.fill";
856 else return "cloud.drizzle.fill";
857 } else if (weatherID > 311 && weatherID <= 321) {
858 if (isNight) return "cloud.moon.rain.fill";
859 else return "cloud.moon.rain.fill";
860 } else if (weatherID >= 500 && weatherID <= 510) {
861 if (isNight) return "cloud.moon.rain.fill";
862 else return "cloud.sun.rain.fill";
863 } else if (weatherID == 511) {
864 if (isNight) return "cloud.hail.fill";
865 else return "cloud.hail.fill";
866 } else if (weatherID > 511 && weatherID <= 531) {
867 if (isNight) return "cloud.heavyrain.fill";
868 else return "cloud.heavyrain.fill";
869 } else if (weatherID >= 600 && weatherID <= 602) {
870 if (isNight) return "snow";
871 else return "snow";
872 } else if (weatherID > 602 && weatherID <= 613) {
873 if (isNight) return "cloud.sleet.fill";
874 else return "cloud.sleet.fill";
875 } else if (weatherID > 613 && weatherID <= 622) {
876 if (isNight) return "cloud.snow.fill";
877 else return "cloud.snow.fill";
878 } else if (weatherID >= 701 && weatherID <= 731) {
879 if (isNight) return "sun.haze.fill";
880 else return "sun.haze.fill";
881 } else if (weatherID == 741) {
882 if (isNight) return "cloud.fog.fill";
883 else return "cloud.fog.fill";
884 } else if (weatherID > 741 && weatherID <= 771) {
885 if (isNight) return "sun.dust.fill";
886 else return "sun.dust.fill";
887 } else if (weatherID == 781) {
888 if (isNight) return "tornado";
889 else return "tornado";
890 } else if (weatherID == 800) {
891 if (isNight) return "moon.stars.fill";
892 else return "sun.max.fill";
893 } else if (weatherID >= 801 && weatherID <= 899) {
894 if (isNight) return "cloud.moon.fill";
895 else return "cloud.sun.fill";
896 } else return "exclamationmark.circle"
897}
898/*------------------------------------------------------------------
899FUNCTION fetchQuotes
900------------------------------------------------------------------*/

Callers 1

updateLayoutFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected