Skip to content

Commit

Permalink
(chore) Improve colors for the graph
Browse files Browse the repository at this point in the history
  • Loading branch information
kounkou committed Nov 5, 2024
1 parent 48aca46 commit 5edaae6
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions qml/StatsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ Rectangle {
QtObject {
id: d

function getBarColor(barHeight) {
let baseBlue = Qt.rgba(0, 0, 0.6, 1);
let lightnessIncrement = Math.min(barHeight * 0.1, 1.0);

return Qt.darker(baseBlue, 1 - 0.9 * lightnessIncrement);
}

function populateGraphRandomData() {
graphData.clear();

Expand Down Expand Up @@ -201,17 +208,7 @@ Rectangle {
ctx.beginPath();
ctx.rect(xPos, yPos, barWidth, barHeight);

var barColor = "#00c8ff";

barHeight = point.score;

if (barHeight <= 2) {
barColor = themeObject.buttonHardColor;
} else if (barHeight > 2 && barHeight <= 4) {
barColor = themeObject.buttonMediumColor;
} else {
barColor = themeObject.buttonEasyColor;
}
var barColor = d.getBarColor(point.score)

ctx.fillStyle = barColor;
ctx.fill();
Expand Down

0 comments on commit 5edaae6

Please sign in to comment.