Skip to content

Commit

Permalink
Merge pull request #99 from kounkou/improve-stats-graph
Browse files Browse the repository at this point in the history
(chore) Improve colors for the graph
  • Loading branch information
kounkou authored Nov 5, 2024
2 parents 48aca46 + 5edaae6 commit 35e7a3e
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 35e7a3e

Please sign in to comment.