1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

weather: fix icons

This commit is contained in:
bbedward
2025-12-24 00:33:54 -05:00
parent 6c56d23b93
commit 8fdc748ed2
3 changed files with 120 additions and 152 deletions

View File

@@ -760,10 +760,10 @@ Item {
color: Theme.outline color: Theme.outline
} }
StyledText { DankNFIcon {
id: moonPhase id: moonPhase
text: WeatherService.getMoonPhase(skyBox.currentDate) || "" name: WeatherService.getMoonPhase(skyBox.currentDate) || ""
font.pixelSize: Theme.fontSizeXLarge * 1 size: Theme.fontSizeXLarge
color: Theme.withAlpha(Theme.surfaceText, 0.7) color: Theme.withAlpha(Theme.surfaceText, 0.7)
rotation: (WeatherService.getMoonAngle(skyBox.currentDate) || 0) / Math.PI * 180 rotation: (WeatherService.getMoonAngle(skyBox.currentDate) || 0) / Math.PI * 180
visible: !!pos visible: !!pos
@@ -783,10 +783,10 @@ Item {
} }
} }
StyledText { DankIcon {
id: sun id: sun
text: "" name: "light_mode"
font.pixelSize: Theme.fontSizeXLarge * 1 size: Theme.fontSizeXLarge
color: Theme.primary color: Theme.primary
visible: !!pos visible: !!pos

View File

@@ -151,56 +151,15 @@ Singleton {
return conditions[String(code)] || "Unknown"; return conditions[String(code)] || "Unknown";
} }
property var moonWeatherIcons: ({ property var moonPhaseNames: ["moon_new", "moon_waxing_crescent", "moon_first_quarter", "moon_waxing_gibbous", "moon_full", "moon_waning_gibbous", "moon_last_quarter", "moon_waning_crescent"]
"0": "",
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"6": "",
"7": "",
"8": "",
"9": "",
"10": "",
"11": "",
"12": "",
"13": "",
"14": "",
"15": "",
"16": "",
"17": "",
"18": "",
"19": "",
"20": "",
"21": "",
"22": "",
"23": "",
"24": "",
"25": "",
"26": "",
"27": ""
})
property var moonMaterialIcons: ({
"0": "󰽤",
"1": "󰽧",
"2": "󰽡",
"3": "󰽦",
"4": "󰽢",
"5": "󰽨",
"6": "󰽣",
"7": "󰽥"
})
function getMoonPhase(date) { function getMoonPhase(date) {
const icons = moonWeatherIcons; // more icons in this set but thinner outline than material icons const phases = moonPhaseNames;
// const icons = moonMaterialIcons const iconCount = phases.length;
const iconCount = Object.keys(icons).length;
const moon = SunCalc.getMoonIllumination(date); const moon = SunCalc.getMoonIllumination(date);
const index = ((Math.floor(moon.phase * iconCount + 0.5) % iconCount) + iconCount) % iconCount; const index = ((Math.floor(moon.phase * iconCount + 0.5) % iconCount) + iconCount) % iconCount;
return icons[index]; return phases[index];
} }
function getMoonAngle(date) { function getMoonAngle(date) {

View File

@@ -119,19 +119,28 @@ Item {
"yml.k8s": "\u{F09EE}", "yml.k8s": "\u{F09EE}",
"yaml.k8s": "\u{F09EE}", "yaml.k8s": "\u{F09EE}",
"tf": "\u{F09EE}", "tf": "\u{F09EE}",
"tfvars": "\u{F09EE}" "tfvars": "\u{F09EE}",
})
// --- moon phases
"moon_new": "\u{F0F64}",
"moon_waxing_crescent": "\u{F0F67}",
"moon_first_quarter": "\u{F0F61}",
"moon_waxing_gibbous": "\u{F0F68}",
"moon_full": "\u{F0F62}",
"moon_waning_gibbous": "\u{F0F66}",
"moon_last_quarter": "\u{F0F63}",
"moon_waning_crescent": "\u{F0F65}"
})
readonly property string text: iconMap[name] || iconMap["file"] || "" readonly property string text: iconMap[name] || iconMap["file"] || ""
function getIconForFile(fileName) { function getIconForFile(fileName) {
const lowerName = fileName.toLowerCase() const lowerName = fileName.toLowerCase();
if (lowerName.startsWith("dockerfile")) { if (lowerName.startsWith("dockerfile")) {
return "docker" return "docker";
} }
const ext = fileName.split('.').pop() const ext = fileName.split('.').pop();
return ext || "" return ext || "";
} }
FontLoader { FontLoader {