tinyhead: fix background colour on the settings screen

pull/3635/head
michele 2024-11-04 23:10:58 +01:00
parent 97113d14be
commit c094d33ef4
3 changed files with 14 additions and 5 deletions

View File

@ -5,8 +5,7 @@
// Read 12/24 from system settings // Read 12/24 from system settings
const is12Hour=(require("Storage").readJSON("setting.json",1)||{})["12hour"] || false; const is12Hour=(require("Storage").readJSON("setting.json",1)||{})["12hour"] || false;
// Tinyhead features are stored at a resolution of 18x21, this scales them to the best fit for the Banglejs2 screen const scale=lib.appScale;
const scale=9;
const closedEyes = 25; const closedEyes = 25;
const scaredEyes = 26; const scaredEyes = 26;
@ -215,6 +214,7 @@
}; };
let init = function init() { let init = function init() {
// change the system theme, so that the widget bar blends in with the clock face
g.setTheme({bg:lib.settings.hairColour,fg:lib.settings.faceColour,dark:true}).clear(); g.setTheme({bg:lib.settings.hairColour,fg:lib.settings.faceColour,dark:true}).clear();
Bangle.on('lock', lockHandler); Bangle.on('lock', lockHandler);

View File

@ -5,6 +5,14 @@ exports.maxEyes = 25;
exports.faceW = 18; exports.faceW = 18;
exports.faceH = 21; exports.faceH = 21;
// Scale used when showing the main clock screen.
// Tinyhead features are stored at a resolution of 18x21, this scales them to the best fit for the Banglejs2 screen
exports.appScale=9;
// Scale used when showing the face on the settings page.
// It's smaller than on the clock itself, so that selection arrows can be shown down the sides
exports.settingsScale=6;
exports.settingsFile = 'tinyheads.json'; exports.settingsFile = 'tinyheads.json';
let faceCanvas; let faceCanvas;
@ -136,7 +144,8 @@ exports.drawFace = function(scale, eyesNum, mouthNum, peek, offset) {
let xOffset = (g.getWidth() - (exports.faceW * scale)) / 2; let xOffset = (g.getWidth() - (exports.faceW * scale)) / 2;
let yOffset = (offset ? offset : 0) + ((g.getHeight() - (exports.faceH * scale)) / 2); let yOffset = (offset ? offset : 0) + ((g.getHeight() - (exports.faceH * scale)) / 2);
if (exports.settings.showWidgets == 'on' || (exports.settings.showWidgets == 'unlock' && !Bangle.isLocked())) { // On the main screen, if the widgets are displayed, the background color matches the color of the hair and widget bar
if (scale == exports.appScale && (exports.settings.showWidgets == 'on' || (exports.settings.showWidgets == 'unlock' && !Bangle.isLocked()))) {
g.setBgColor(exports.settings.hairColour); g.setBgColor(exports.settings.hairColour);
} else { } else {
g.setBgColor(0, 0, 0); g.setBgColor(0, 0, 0);

View File

@ -6,7 +6,7 @@
let featureColour = 'faceColour'; let featureColour = 'faceColour';
let colourSelectTimeout; let colourSelectTimeout;
let scale = 6; // Smaller scale than on the clock itself, so that selection arrows can be shown down the sides const scale = lib.settingsScale;
// 27 colours // 27 colours
let colours = [ let colours = [