Merge pull request #3525 from bobrippling/fix/slopeclockpp-clkinfo-colour

slopeclockpp: avoid reusing background colour for clkinfo
pull/3532/head
Rob Pilling 2024-08-05 20:06:21 +01:00 committed by GitHub
commit f59a198e2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 6 deletions

View File

@ -11,3 +11,4 @@
Stop ClockInfo text drawing outside the allocated area Stop ClockInfo text drawing outside the allocated area
0.09: Use clock_info module as an app 0.09: Use clock_info module as an app
0.10: Option to hide widgets, tweak top widget width to avoid overlap with hour text at 9am 0.10: Option to hide widgets, tweak top widget width to avoid overlap with hour text at 9am
0.11: Avoid rendering clkinfo in the same colour as the background

View File

@ -86,6 +86,7 @@ let draw = function() {
let isAnimIn = true; let isAnimIn = true;
let animInterval; let animInterval;
let minuteX;
// Draw *just* the minute image // Draw *just* the minute image
let drawMinute = function() { let drawMinute = function() {
var yo = slopeBorder + offsy + y - 2*slope*minuteX/R.w; var yo = slopeBorder + offsy + y - 2*slope*minuteX/R.w;
@ -128,9 +129,9 @@ let clockInfoDraw = (itm, info, options) => {
let texty = options.y+41; let texty = options.y+41;
// set a cliprect to stop us drawing outside our box // set a cliprect to stop us drawing outside our box
g.reset().setClipRect(options.x, options.y, options.x+options.w-1, options.y+options.h-1); g.reset().setClipRect(options.x, options.y, options.x+options.w-1, options.y+options.h-1);
g.setFont("6x15").setBgColor(options.bg).setColor(options.fg).clearRect(options.x, texty-15, options.x+options.w-2, texty); g.setFont("6x15").setBgColor(options.bg).clearRect(options.x, texty-15, options.x+options.w-2, texty);
if (options.focus) g.setColor(options.hl); g.setColor(options.focus ? options.hl : options.fg);
if (options.x < g.getWidth()/2) { // left align if (options.x < g.getWidth()/2) { // left align
let x = options.x+2; let x = options.x+2;
if (info.img) g.clearRect(x, options.y, x+23, options.y+23).drawImage(info.img, x, options.y); if (info.img) g.clearRect(x, options.y, x+23, options.y+23).drawImage(info.img, x, options.y);
@ -150,7 +151,7 @@ let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { // t
}); });
let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { // bottom left let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { // bottom left
app:"slopeclockpp",x:0, y:115, w:50, h:40, app:"slopeclockpp",x:0, y:115, w:50, h:40,
draw : clockInfoDraw, bg : bgColor, fg : g.theme.bg, hl : (bgColor=="#000")?"#f00"/*red*/:g.theme.fg draw : clockInfoDraw, bg : bgColor, fg : g.theme.bg, hl : (g.theme.fg===g.toColor(bgColor))?"#f00"/*red*/:g.theme.fg
}); });
// Show launcher when middle button pressed // Show launcher when middle button pressed

View File

@ -1,6 +1,6 @@
{ "id": "slopeclockpp", { "id": "slopeclockpp",
"name": "Slope Clock ++", "name": "Slope Clock ++",
"version":"0.10", "version":"0.11",
"description": "A clock where hours and minutes are divided by a sloping line. When the minute changes, the numbers slide off the screen. This is a clone of the original Slope Clock which shows extra information and allows the colors to be selected.", "description": "A clock where hours and minutes are divided by a sloping line. When the minute changes, the numbers slide off the screen. This is a clone of the original Slope Clock which shows extra information and allows the colors to be selected.",
"icon": "app.png", "icon": "app.png",
"screenshots": [{"url":"screenshot.png"}], "screenshots": [{"url":"screenshot.png"}],