circlesclock: using suggested color from clock_info

pull/2499/head
Gabriele Monaco 2023-01-13 13:34:58 +01:00
parent 0cc4e318f8
commit 0217c17ebe
4 changed files with 10 additions and 6 deletions

View File

@ -40,3 +40,4 @@
Now re-adds widgets if they were hidden when fast-loading
0.22: Fixed crash if item has no image and cutting long overflowing text
0.23: Setting circles colours per clkinfo and not position
0.24: Using suggested color from clock_info if set as default and available

View File

@ -116,11 +116,13 @@ let draw = function() {
queueDraw();
}
let getCircleColor = function(item, clkmenu) {
let getCircleColor = function(item, data, clkmenu) {
let colorKey = clkmenu.name;
if(!clkmenu.dynamic) colorKey += "/"+item.name;
colorKey += "_color";
let color = settings[colorKey];
//use default color only if no other color is set
if(data.color && !color) return data.color;
if (color && color != "") return color;
return g.theme.fg;
}
@ -137,10 +139,12 @@ let getGradientColor = function(color, percent) {
if (color == "green-red") {
let colorIndex = Math.round(colorList.length * percent);
return colorList[Math.min(colorIndex, colorList.length) - 1] || "#00ff00";
//return g.blendColor('#00ff00', '#ff0000', percent); //mostly dithering
}
if (color == "red-green") {
let colorIndex = colorList.length - Math.round(colorList.length * percent);
return colorList[Math.min(colorIndex, colorList.length)] || "#ff0000";
//return g.blendColor('#ff0000', '#00ff00', percent);
}
colorList = [
'#0000ff', '#8800ff', '#ff00ff', '#ff0088', '#ff0000'
@ -148,10 +152,12 @@ let getGradientColor = function(color, percent) {
if (color == "blue-red") {
let colorIndex = Math.round(colorList.length * percent);
return colorList[Math.min(colorIndex, colorList.length) - 1] || "#0000ff";
//return g.blendColor('#0000ff', '#ff0000', percent);
}
if (color == "red-blue") {
let colorIndex = colorList.length - Math.round(colorList.length * percent);
return colorList[Math.min(colorIndex, colorList.length)] || "#ff0000";
//return g.blendColor('#ff0000', '#0000ff', percent);
}
return color;
}
@ -177,7 +183,7 @@ let drawEmpty = function(img, w, color) {
let drawCircle = function(index, item, data, clkmenu) {
var w = circlePosX[index-1];
drawCircleBackground(w);
const color = getCircleColor(item, clkmenu);
const color = getCircleColor(item, data, clkmenu);
//drawEmpty(info? info.img : null, w, color);
var img = data.img;
var percent = 1; //fill up if no range

View File

@ -7,13 +7,10 @@
"Bangle/Steps_color":"#0000ff",
"Bangle/HRM_color":"green-red",
"Bangle/Altitude_color":"#00ff00",
"Weather/conditionWithTemperature_color":"#ffff00",
"Weather/condition_color":"#00ffff",
"Weather/humidity_color":"#00ffff",
"Weather/wind_color":"fg",
"Weather/temperature_color":"blue-red",
"Alarms_color":"#00ff00",
"Agenda_color":"#ff0000",
"circle1colorizeIcon": true,
"circle2colorizeIcon": true,
"circle3colorizeIcon": true,

View File

@ -1,7 +1,7 @@
{ "id": "circlesclock",
"name": "Circles clock",
"shortName":"Circles clock",
"version":"0.23",
"version":"0.24",
"description": "A clock with three or four circles for different data at the bottom in a probably familiar style",
"icon": "app.png",
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],