circlesclock: using suggested color from clock_info
parent
0cc4e318f8
commit
0217c17ebe
|
|
@ -40,3 +40,4 @@
|
||||||
Now re-adds widgets if they were hidden when fast-loading
|
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.22: Fixed crash if item has no image and cutting long overflowing text
|
||||||
0.23: Setting circles colours per clkinfo and not position
|
0.23: Setting circles colours per clkinfo and not position
|
||||||
|
0.24: Using suggested color from clock_info if set as default and available
|
||||||
|
|
|
||||||
|
|
@ -116,11 +116,13 @@ let draw = function() {
|
||||||
queueDraw();
|
queueDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
let getCircleColor = function(item, clkmenu) {
|
let getCircleColor = function(item, data, clkmenu) {
|
||||||
let colorKey = clkmenu.name;
|
let colorKey = clkmenu.name;
|
||||||
if(!clkmenu.dynamic) colorKey += "/"+item.name;
|
if(!clkmenu.dynamic) colorKey += "/"+item.name;
|
||||||
colorKey += "_color";
|
colorKey += "_color";
|
||||||
let color = settings[colorKey];
|
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;
|
if (color && color != "") return color;
|
||||||
return g.theme.fg;
|
return g.theme.fg;
|
||||||
}
|
}
|
||||||
|
|
@ -137,10 +139,12 @@ let getGradientColor = function(color, percent) {
|
||||||
if (color == "green-red") {
|
if (color == "green-red") {
|
||||||
let colorIndex = Math.round(colorList.length * percent);
|
let colorIndex = Math.round(colorList.length * percent);
|
||||||
return colorList[Math.min(colorIndex, colorList.length) - 1] || "#00ff00";
|
return colorList[Math.min(colorIndex, colorList.length) - 1] || "#00ff00";
|
||||||
|
//return g.blendColor('#00ff00', '#ff0000', percent); //mostly dithering
|
||||||
}
|
}
|
||||||
if (color == "red-green") {
|
if (color == "red-green") {
|
||||||
let colorIndex = colorList.length - Math.round(colorList.length * percent);
|
let colorIndex = colorList.length - Math.round(colorList.length * percent);
|
||||||
return colorList[Math.min(colorIndex, colorList.length)] || "#ff0000";
|
return colorList[Math.min(colorIndex, colorList.length)] || "#ff0000";
|
||||||
|
//return g.blendColor('#ff0000', '#00ff00', percent);
|
||||||
}
|
}
|
||||||
colorList = [
|
colorList = [
|
||||||
'#0000ff', '#8800ff', '#ff00ff', '#ff0088', '#ff0000'
|
'#0000ff', '#8800ff', '#ff00ff', '#ff0088', '#ff0000'
|
||||||
|
|
@ -148,10 +152,12 @@ let getGradientColor = function(color, percent) {
|
||||||
if (color == "blue-red") {
|
if (color == "blue-red") {
|
||||||
let colorIndex = Math.round(colorList.length * percent);
|
let colorIndex = Math.round(colorList.length * percent);
|
||||||
return colorList[Math.min(colorIndex, colorList.length) - 1] || "#0000ff";
|
return colorList[Math.min(colorIndex, colorList.length) - 1] || "#0000ff";
|
||||||
|
//return g.blendColor('#0000ff', '#ff0000', percent);
|
||||||
}
|
}
|
||||||
if (color == "red-blue") {
|
if (color == "red-blue") {
|
||||||
let colorIndex = colorList.length - Math.round(colorList.length * percent);
|
let colorIndex = colorList.length - Math.round(colorList.length * percent);
|
||||||
return colorList[Math.min(colorIndex, colorList.length)] || "#ff0000";
|
return colorList[Math.min(colorIndex, colorList.length)] || "#ff0000";
|
||||||
|
//return g.blendColor('#ff0000', '#0000ff', percent);
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
@ -177,7 +183,7 @@ let drawEmpty = function(img, w, color) {
|
||||||
let drawCircle = function(index, item, data, clkmenu) {
|
let drawCircle = function(index, item, data, clkmenu) {
|
||||||
var w = circlePosX[index-1];
|
var w = circlePosX[index-1];
|
||||||
drawCircleBackground(w);
|
drawCircleBackground(w);
|
||||||
const color = getCircleColor(item, clkmenu);
|
const color = getCircleColor(item, data, clkmenu);
|
||||||
//drawEmpty(info? info.img : null, w, color);
|
//drawEmpty(info? info.img : null, w, color);
|
||||||
var img = data.img;
|
var img = data.img;
|
||||||
var percent = 1; //fill up if no range
|
var percent = 1; //fill up if no range
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,10 @@
|
||||||
"Bangle/Steps_color":"#0000ff",
|
"Bangle/Steps_color":"#0000ff",
|
||||||
"Bangle/HRM_color":"green-red",
|
"Bangle/HRM_color":"green-red",
|
||||||
"Bangle/Altitude_color":"#00ff00",
|
"Bangle/Altitude_color":"#00ff00",
|
||||||
"Weather/conditionWithTemperature_color":"#ffff00",
|
|
||||||
"Weather/condition_color":"#00ffff",
|
|
||||||
"Weather/humidity_color":"#00ffff",
|
"Weather/humidity_color":"#00ffff",
|
||||||
"Weather/wind_color":"fg",
|
"Weather/wind_color":"fg",
|
||||||
"Weather/temperature_color":"blue-red",
|
"Weather/temperature_color":"blue-red",
|
||||||
"Alarms_color":"#00ff00",
|
"Alarms_color":"#00ff00",
|
||||||
"Agenda_color":"#ff0000",
|
|
||||||
"circle1colorizeIcon": true,
|
"circle1colorizeIcon": true,
|
||||||
"circle2colorizeIcon": true,
|
"circle2colorizeIcon": true,
|
||||||
"circle3colorizeIcon": true,
|
"circle3colorizeIcon": true,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ "id": "circlesclock",
|
{ "id": "circlesclock",
|
||||||
"name": "Circles clock",
|
"name": "Circles clock",
|
||||||
"shortName":"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",
|
"description": "A clock with three or four circles for different data at the bottom in a probably familiar style",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],
|
"screenshots": [{"url":"screenshot-dark.png"}, {"url":"screenshot-light.png"}, {"url":"screenshot-dark-4.png"}, {"url":"screenshot-light-4.png"}],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue