mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-15 18:22:08 -04:00
weather: fix icons
This commit is contained in:
@@ -760,10 +760,10 @@ Item {
|
||||
color: Theme.outline
|
||||
}
|
||||
|
||||
StyledText {
|
||||
DankNFIcon {
|
||||
id: moonPhase
|
||||
text: WeatherService.getMoonPhase(skyBox.currentDate) || ""
|
||||
font.pixelSize: Theme.fontSizeXLarge * 1
|
||||
name: WeatherService.getMoonPhase(skyBox.currentDate) || ""
|
||||
size: Theme.fontSizeXLarge
|
||||
color: Theme.withAlpha(Theme.surfaceText, 0.7)
|
||||
rotation: (WeatherService.getMoonAngle(skyBox.currentDate) || 0) / Math.PI * 180
|
||||
visible: !!pos
|
||||
@@ -783,10 +783,10 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
DankIcon {
|
||||
id: sun
|
||||
text: ""
|
||||
font.pixelSize: Theme.fontSizeXLarge * 1
|
||||
name: "light_mode"
|
||||
size: Theme.fontSizeXLarge
|
||||
color: Theme.primary
|
||||
visible: !!pos
|
||||
|
||||
|
||||
@@ -151,56 +151,15 @@ Singleton {
|
||||
return conditions[String(code)] || "Unknown";
|
||||
}
|
||||
|
||||
property var moonWeatherIcons: ({
|
||||
"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": ""
|
||||
})
|
||||
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"]
|
||||
|
||||
function getMoonPhase(date) {
|
||||
const icons = moonWeatherIcons; // more icons in this set but thinner outline than material icons
|
||||
// const icons = moonMaterialIcons
|
||||
const iconCount = Object.keys(icons).length;
|
||||
const phases = moonPhaseNames;
|
||||
const iconCount = phases.length;
|
||||
const moon = SunCalc.getMoonIllumination(date);
|
||||
const index = ((Math.floor(moon.phase * iconCount + 0.5) % iconCount) + iconCount) % iconCount;
|
||||
|
||||
return icons[index];
|
||||
return phases[index];
|
||||
}
|
||||
|
||||
function getMoonAngle(date) {
|
||||
|
||||
@@ -119,19 +119,28 @@ Item {
|
||||
"yml.k8s": "\u{F09EE}",
|
||||
"yaml.k8s": "\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"] || ""
|
||||
|
||||
function getIconForFile(fileName) {
|
||||
const lowerName = fileName.toLowerCase()
|
||||
const lowerName = fileName.toLowerCase();
|
||||
if (lowerName.startsWith("dockerfile")) {
|
||||
return "docker"
|
||||
return "docker";
|
||||
}
|
||||
const ext = fileName.split('.').pop()
|
||||
return ext || ""
|
||||
const ext = fileName.split('.').pop();
|
||||
return ext || "";
|
||||
}
|
||||
|
||||
FontLoader {
|
||||
|
||||
Reference in New Issue
Block a user