Update calendar.js

If week is set to start on Sunday, make Saturday (last row) and Sunday (first row) have weekend colors.
master
Craig Millett 2021-12-21 12:11:30 -07:00 committed by GitHub
parent d9d5926416
commit 48da0cbacf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 4 deletions

View File

@ -110,10 +110,19 @@ function drawCalendar(date) {
g.clearRect(0, 0, maxX, maxY); g.clearRect(0, 0, maxX, maxY);
g.setBgColor(bgColorMonth); g.setBgColor(bgColorMonth);
g.clearRect(0, 0, maxX, headerH); g.clearRect(0, 0, maxX, headerH);
if (settings.startOnSun){
g.setBgColor(bgColorWeekend);
g.clearRect(0, headerH + rowH, colW, maxY);
g.setBgColor(bgColorDow);
g.clearRect(0, headerH, maxX, headerH + rowH);
g.setBgColor(bgColorWeekend);
g.clearRect(colW * 6, headerH + rowH, maxX, maxY);
} else {
g.setBgColor(bgColorDow); g.setBgColor(bgColorDow);
g.clearRect(0, headerH, maxX, headerH + rowH); g.clearRect(0, headerH, maxX, headerH + rowH);
g.setBgColor(bgColorWeekend); g.setBgColor(bgColorWeekend);
g.clearRect(colW * 5, headerH + rowH, maxX, maxY); g.clearRect(colW * 5, headerH + rowH, maxX, maxY);
}
for (let y = headerH; y < maxY; y += rowH) { for (let y = headerH; y < maxY; y += rowH) {
g.drawLine(0, y, maxX, y); g.drawLine(0, y, maxX, y);
} }