Merge pull request #3950 from RKBoss6/modclk-updates

[Modern Clock] Add settings to change color when clockInfo is focused
master
thyttan 2025-08-10 13:36:53 +02:00 committed by GitHub
commit 747c3d367e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 67 additions and 8 deletions

View File

@ -2,3 +2,4 @@
0.02: Added text truncation for long ClockInfo strings.
0.03: Added small inline Clock Info next to date
0.04: Fix date not clearing
0.05: Add settings menu with option for accent color when focusing on clockInfo

View File

@ -18,7 +18,9 @@ A beautifully simple, modern clock with three Clock Infos, and a clean UI. Fast-
* Uses rounded rectangles and a bold font for a simple, clean, modern look.
* Has Fast Loading, for quicker access to launcher.
## Settings
### Accent Color
- The color clockInfos draw as when focused (tapped or changed).
## Creator
RKBoss6

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
"name": "Modern Clock",
"shortName":"Modern Clk",
"icon": "icon.png",
"version":"0.04",
"version":"0.05",
"description": "A modern, simple clock, with three ClockInfos and Fast Loading",
"type":"clock",
"tags": "clock,clkinfo",
@ -15,6 +15,10 @@
"readme":"README.md",
"storage": [
{"name":"modclock.app.js","url":"app.js"},
{"name":"modclock.img","url":"app-icon.js","evaluate":true}
{"name":"modclock.img","url":"app-icon.js","evaluate":true},
{"name":"modclock.settings.js","url":"settings.js"}
],
"data": [
{"name":"modclock.settings.json"}
]
}

48
apps/modclock/settings.js Normal file
View File

@ -0,0 +1,48 @@
(function(back) {
const FILE = "modclock.settings.json";
let settings = Object.assign({
color: "#00FF00" // default (green)
}, require('Storage').readJSON(FILE, true) || {});
function save() {
require('Storage').writeJSON(FILE, settings);
console.log("Saved settings:", settings);
}
const colors = {
"Red": "#FF0000",
"Green": "#00FF00",
"Blue": "#0000FF",
"Yellow": "#FFFF00",
"Purple": "#FF00FF",
"Cyan": "#00FFFF"
};
function showMainMenu(back) {
E.showMenu({
"" : { title : "Modern Clock" },
"< Back" : () => back(),
"Accent Color" : () => showColorMenu(back)
});
}
function showColorMenu() {
const menu = {
"" : { title: "Pick Color" },
"< Back" : () => showMainMenu(back)
};
for (let name in colors) {
(function(n) {
menu[n] = () => {
settings.color = colors[n];
save();
showMainMenu(back);
};
})(name);
}
E.showMenu(menu);
}
showMainMenu(back);
})