mirror of https://github.com/espruino/BangleApps
wohrm: Use theme colors
parent
09e7330ae0
commit
0456843385
|
@ -31,8 +31,7 @@ const upperLshape = {
|
||||||
rectWidth: 30,
|
rectWidth: 30,
|
||||||
cornerRoundness: 5,
|
cornerRoundness: 5,
|
||||||
orientation: -1,
|
orientation: -1,
|
||||||
bgColor: 0,
|
color: '#f00'
|
||||||
fgColor: '#f00'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const lowerLshape = {
|
const lowerLshape = {
|
||||||
|
@ -43,8 +42,7 @@ const lowerLshape = {
|
||||||
rectWidth: 30,
|
rectWidth: 30,
|
||||||
cornerRoundness: 5,
|
cornerRoundness: 5,
|
||||||
orientation: 1,
|
orientation: 1,
|
||||||
bgColor: 0,
|
color: '#00f'
|
||||||
fgColor: '#00f'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const centerBar = {
|
const centerBar = {
|
||||||
|
@ -63,7 +61,7 @@ function fillEllipse(x, y, x2, y2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLshape(p) {
|
function renderLshape(p) {
|
||||||
g.setColor(p.fgColor);
|
g.setColor(p.color);
|
||||||
|
|
||||||
g.fillRect(p.minX, p.minY, p.maxX, p.minY-p.orientation*p.rectWidth);
|
g.fillRect(p.minX, p.minY, p.maxX, p.minY-p.orientation*p.rectWidth);
|
||||||
g.fillRect(p.maxX+p.orientation*p.rectWidth,
|
g.fillRect(p.maxX+p.orientation*p.rectWidth,
|
||||||
|
@ -78,12 +76,12 @@ function renderLshape(p) {
|
||||||
p.minY-p.orientation*p.rectWidth);
|
p.minY-p.orientation*p.rectWidth);
|
||||||
|
|
||||||
//Round outer corner
|
//Round outer corner
|
||||||
g.setColor(p.bgColor);
|
g.setColor(g.theme.bg);
|
||||||
g.fillRect(p.maxX+p.orientation*p.cornerRoundness,
|
g.fillRect(p.maxX+p.orientation*p.cornerRoundness,
|
||||||
p.minY,
|
p.minY,
|
||||||
p.maxX,
|
p.maxX,
|
||||||
p.minY-p.orientation*p.cornerRoundness);
|
p.minY-p.orientation*p.cornerRoundness);
|
||||||
g.setColor(p.fgColor);
|
g.setColor(p.color);
|
||||||
fillEllipse(p.maxX+p.orientation*p.cornerRoundness*4,
|
fillEllipse(p.maxX+p.orientation*p.cornerRoundness*4,
|
||||||
p.minY,
|
p.minY,
|
||||||
p.maxX,
|
p.maxX,
|
||||||
|
@ -94,14 +92,14 @@ function renderLshape(p) {
|
||||||
p.minY-p.orientation*(p.rectWidth+1),
|
p.minY-p.orientation*(p.rectWidth+1),
|
||||||
p.maxX+p.orientation*(p.rectWidth+1),
|
p.maxX+p.orientation*(p.rectWidth+1),
|
||||||
p.minY-p.orientation*(p.rectWidth+p.cornerRoundness-1));
|
p.minY-p.orientation*(p.rectWidth+p.cornerRoundness-1));
|
||||||
g.setColor(p.bgColor);
|
g.setColor(g.theme.bg);
|
||||||
fillEllipse(p.maxX+p.orientation*(p.rectWidth+p.cornerRoundness*4),
|
fillEllipse(p.maxX+p.orientation*(p.rectWidth+p.cornerRoundness*4),
|
||||||
p.minY-p.orientation*(p.rectWidth+1),
|
p.minY-p.orientation*(p.rectWidth+1),
|
||||||
p.maxX+p.orientation*(p.rectWidth+1),
|
p.maxX+p.orientation*(p.rectWidth+1),
|
||||||
p.minY-p.orientation*(p.rectWidth+p.cornerRoundness*3-1));
|
p.minY-p.orientation*(p.rectWidth+p.cornerRoundness*3-1));
|
||||||
|
|
||||||
//Round end of long line
|
//Round end of long line
|
||||||
g.setColor(p.fgColor);
|
g.setColor(p.color);
|
||||||
fillEllipse(p.maxX+p.orientation*p.rectWidth,
|
fillEllipse(p.maxX+p.orientation*p.rectWidth,
|
||||||
p.maxY+p.orientation*p.cornerRoundness*4,
|
p.maxY+p.orientation*p.cornerRoundness*4,
|
||||||
p.maxX,
|
p.maxX,
|
||||||
|
@ -129,9 +127,9 @@ function renderUpperLimit() {
|
||||||
renderLshape(upperLshape);
|
renderLshape(upperLshape);
|
||||||
|
|
||||||
if(limitSetter === Setter.UPPER){
|
if(limitSetter === Setter.UPPER){
|
||||||
g.setColor(255,255, 0);
|
g.setColor(1,1,0);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(255,255,255);
|
g.setColor(g.theme.fg);
|
||||||
}
|
}
|
||||||
g.setFontVector(13).setFontAlign(-1, 0, 0);
|
g.setFontVector(13).setFontAlign(-1, 0, 0);
|
||||||
g.drawString("Upper: " + upperLimit,
|
g.drawString("Upper: " + upperLimit,
|
||||||
|
@ -144,11 +142,11 @@ function renderUpperLimit() {
|
||||||
function renderCurrentHeartRate() {
|
function renderCurrentHeartRate() {
|
||||||
if(!hrChanged) { return; }
|
if(!hrChanged) { return; }
|
||||||
|
|
||||||
g.setColor(1, 1, 1);
|
g.setColor(g.theme.fg);
|
||||||
g.fillRect(centerBar.minX, centerBar.minY,
|
g.fillRect(centerBar.minX, centerBar.minY,
|
||||||
centerBar.maxX, centerBar.maxY);
|
centerBar.maxX, centerBar.maxY);
|
||||||
|
|
||||||
g.setColor(0,0,0);
|
g.setColor(g.theme.bg);
|
||||||
g.setFontVector(24);
|
g.setFontVector(24);
|
||||||
g.setFontAlign(1, 0, 0);
|
g.setFontAlign(1, 0, 0);
|
||||||
g.drawString(currentHeartRate,
|
g.drawString(currentHeartRate,
|
||||||
|
@ -167,9 +165,9 @@ function renderLowerLimit() {
|
||||||
renderLshape(lowerLshape);
|
renderLshape(lowerLshape);
|
||||||
|
|
||||||
if(limitSetter === Setter.LOWER){
|
if(limitSetter === Setter.LOWER){
|
||||||
g.setColor(255,255, 0);
|
g.setColor(1,1,0);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(255,255,255);
|
g.setColor(g.theme.fg);
|
||||||
}
|
}
|
||||||
g.setFontVector(13).setFontAlign(-1, 0, 0);
|
g.setFontVector(13).setFontAlign(-1, 0, 0);
|
||||||
g.drawString("Lower: " + lowerLimit,
|
g.drawString("Lower: " + lowerLimit,
|
||||||
|
@ -183,13 +181,13 @@ function renderConfidenceBars(){
|
||||||
if(!confidenceChanged) { return; }
|
if(!confidenceChanged) { return; }
|
||||||
|
|
||||||
if(hrConfidence >= 85){
|
if(hrConfidence >= 85){
|
||||||
g.setColor(0, 255, 0);
|
g.setColor(0, 1, 0);
|
||||||
} else if (hrConfidence >= 50) {
|
} else if (hrConfidence >= 50) {
|
||||||
g.setColor(255, 255, 0);
|
g.setColor(1, 1, 0);
|
||||||
} else if(hrConfidence >= 0){
|
} else if(hrConfidence >= 0){
|
||||||
g.setColor(255, 0, 0);
|
g.setColor(1, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(255, 255, 255);
|
g.setColor(g.theme.fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
g.fillRect(centerBar.minX-centerBar.confidenceWidth, centerBar.minY, centerBar.minX, centerBar.maxY);
|
g.fillRect(centerBar.minX-centerBar.confidenceWidth, centerBar.minY, centerBar.minX, centerBar.maxY);
|
||||||
|
@ -200,9 +198,9 @@ function renderConfidenceBars(){
|
||||||
|
|
||||||
function renderPlusMinusIcons() {
|
function renderPlusMinusIcons() {
|
||||||
if (limitSetter === Setter.NONE) {
|
if (limitSetter === Setter.NONE) {
|
||||||
g.setColor(0, 0, 0);
|
g.setColor(g.theme.bg);
|
||||||
} else {
|
} else {
|
||||||
g.setColor(1, 1, 1);
|
g.setColor(g.theme.fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
g.setFontVector(14);
|
g.setFontVector(14);
|
||||||
|
|
Loading…
Reference in New Issue