From 0217c17ebed9ba70ab11f7850321a2e0742063ff Mon Sep 17 00:00:00 2001 From: Gabriele Monaco Date: Fri, 13 Jan 2023 13:34:58 +0100 Subject: [PATCH] circlesclock: using suggested color from clock_info --- apps/circlesclock/ChangeLog | 1 + apps/circlesclock/app.js | 10 ++++++++-- apps/circlesclock/default.json | 3 --- apps/circlesclock/metadata.json | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/circlesclock/ChangeLog b/apps/circlesclock/ChangeLog index 830bc28e8..01a51e094 100644 --- a/apps/circlesclock/ChangeLog +++ b/apps/circlesclock/ChangeLog @@ -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 diff --git a/apps/circlesclock/app.js b/apps/circlesclock/app.js index e1fc8d846..583763af1 100644 --- a/apps/circlesclock/app.js +++ b/apps/circlesclock/app.js @@ -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 diff --git a/apps/circlesclock/default.json b/apps/circlesclock/default.json index 9d5b3e242..c343a8131 100644 --- a/apps/circlesclock/default.json +++ b/apps/circlesclock/default.json @@ -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, diff --git a/apps/circlesclock/metadata.json b/apps/circlesclock/metadata.json index 45b869521..7fc18af1b 100644 --- a/apps/circlesclock/metadata.json +++ b/apps/circlesclock/metadata.json @@ -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"}],