Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions widget/source/AppGlance.mc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Toybox.WatchUi as Ui;
using Toybox.System as System;
using Hass;
using Utils;

Expand All @@ -25,12 +26,19 @@ class AppGlance extends Ui.GlanceView {
var textDimensions = dc.getTextDimensions(text, font);
var textHeight = textDimensions[1];


var bg = System.getDeviceSettings().isNightModeEnabled ? Graphics.COLOR_BLACK : Graphics.COLOR_WHITE;
var fg = bg == Graphics.COLOR_BLACK ? Graphics.COLOR_WHITE : Graphics.COLOR_BLACK;

dc.setColor(bg, bg);
dc.clear();

dc.setColor(fg,bg);

// Adjust text position based on screen shape
if (Utils.isRectangularScreen()) {
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK);
dc.drawText(10, (height / 2) - (textHeight / 2), font, text, Graphics.TEXT_JUSTIFY_LEFT);
} else {
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK);
dc.drawText(5, (height / 2) - (textHeight / 2), font, text, Graphics.TEXT_JUSTIFY_LEFT);
}
}
Expand Down