mirror of https://github.com/espruino/BangleApps
calendar: re-add ndColors setting
parent
aac031489c
commit
f78818ae00
|
@ -16,5 +16,4 @@
|
|||
0.14: Add support for holidays
|
||||
0.15: Edit holidays on device in settings
|
||||
0.16: Add menu to fast open settings to edit holidays
|
||||
Drop "B2 Colors" setting, use theme dark indicator instead
|
||||
Display Widgets in menus
|
||||
|
|
|
@ -11,3 +11,7 @@ Monthly calendar, displays holidays uploaded from the web interface and schedule
|
|||
- Touch to display events for current month
|
||||
- Press the button (button 3 on Bangle.js 1) to exit
|
||||
- Holidays have same color as weekends and can be edited with the 'Download'-interface, e.g. by uploading an iCalendar file.
|
||||
|
||||
## Settings
|
||||
|
||||
B2 Colors: use non-dithering colors (default, recommended for Bangle 2) or the original color scheme.
|
||||
|
|
|
@ -55,7 +55,11 @@ const loadEvents = () => {
|
|||
});
|
||||
};
|
||||
|
||||
if (!g.theme.dark) {
|
||||
if (settings.ndColors === undefined) {
|
||||
settings.ndColors = !g.theme.dark;
|
||||
}
|
||||
|
||||
if (settings.ndColors === true) {
|
||||
bgColor = white;
|
||||
bgColorMonth = blue;
|
||||
bgColorDow = black;
|
||||
|
@ -100,7 +104,7 @@ const drawEvent = function(ev, curDay, x1, y1, x2, y2) {
|
|||
g.setColor(bgOtherEvent).fillRect(x1+1, y1+1, x2-1, y2-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const drawCalendar = function(date) {
|
||||
g.setBgColor(bgColor);
|
||||
|
|
|
@ -3,12 +3,19 @@
|
|||
const HOLIDAY_FILE = "calendar.days.json";
|
||||
var settings = require('Storage').readJSON(FILE, true) || {};
|
||||
if (settings.ndColors === undefined)
|
||||
if (process.env.HWVERSION == 2) {
|
||||
settings.ndColors = true;
|
||||
} else {
|
||||
settings.ndColors = false;
|
||||
}
|
||||
if (settings.ndColors === undefined) {
|
||||
if (process.env.HWVERSION == 2) {
|
||||
settings.ndColors = true;
|
||||
} else {
|
||||
settings.ndColors = false;
|
||||
}
|
||||
const holidays = require("Storage").readJSON(HOLIDAY_FILE,1).sort((a,b) => new Date(a.date) - new Date(b.date)) || [];
|
||||
}
|
||||
const holidays = (require("Storage").readJSON(HOLIDAY_FILE,1)||[]).sort((a,b) => new Date(a.date) - new Date(b.date)) || [];
|
||||
|
||||
function writeSettings() {
|
||||
require('Storage').writeJSON(FILE, settings);
|
||||
|
@ -132,6 +139,13 @@
|
|||
E.showMenu({
|
||||
"": { "title": "Calendar" },
|
||||
"< Back": () => back(),
|
||||
'B2 Colors': {
|
||||
value: settings.ndColors,
|
||||
onchange: v => {
|
||||
settings.ndColors = v;
|
||||
writeSettings();
|
||||
}
|
||||
},
|
||||
/*LANG*/"Edit Holidays": () => editdates(),
|
||||
/*LANG*/"Add Holiday": () => {
|
||||
holidays.push({
|
||||
|
|
Loading…
Reference in New Issue