diff --git a/grades/grades.js b/grades/grades.js index 0f643d7..a54100d 100644 --- a/grades/grades.js +++ b/grades/grades.js @@ -532,6 +532,9 @@ if (!ctx) return; const gradePoints = calculateGradePoints(subjects); + const accentColor = getComputedStyle(document.documentElement) + .getPropertyValue("--accent-accent") + .trim(); new Chart(ctx, { type: "line", @@ -542,28 +545,8 @@ label: "Átlag", data: gradePoints.map((p) => p.average), borderWidth: 5, + borderColor: accentColor, tension: 0.5, - segment: { - borderColor: (ctx) => { - const curr = ctx.p1.parsed.y; - if (!curr) return "transparent"; - const color = - getComputedStyle(document.documentElement) - .getPropertyValue( - curr < 2 - ? "--grades-1" - : curr < 2.5 - ? "--grades-2" - : curr < 3.5 - ? "--grades-3" - : curr < 4.5 - ? "--grades-4" - : "--grades-5", - ) - .trim() + "80"; - return color; - }, - }, fill: true, backgroundColor: function (context) { const chart = context.chart; @@ -577,55 +560,12 @@ chartArea.top, ); - gradientBg.addColorStop( - 0, - getComputedStyle(document.documentElement) - .getPropertyValue("--grades-1") - .trim() + "30", - ); - gradientBg.addColorStop( - 0.2, - getComputedStyle(document.documentElement) - .getPropertyValue("--grades-2") - .trim() + "30", - ); - gradientBg.addColorStop( - 0.4, - getComputedStyle(document.documentElement) - .getPropertyValue("--grades-3") - .trim() + "30", - ); - gradientBg.addColorStop( - 0.6, - getComputedStyle(document.documentElement) - .getPropertyValue("--grades-4") - .trim() + "30", - ); - gradientBg.addColorStop( - 0.8, - getComputedStyle(document.documentElement) - .getPropertyValue("--grades-5") - .trim() + "30", - ); + gradientBg.addColorStop(0, accentColor + "30"); + gradientBg.addColorStop(1, accentColor + "10"); return gradientBg; }, - pointBackgroundColor: (context) => { - const value = context.raw; - return getComputedStyle(document.documentElement) - .getPropertyValue( - value < 2 - ? "--grades-1" - : value < 2.5 - ? "--grades-2" - : value < 3.5 - ? "--grades-3" - : value < 4.5 - ? "--grades-4" - : "--grades-5", - ) - .trim(); - }, + pointBackgroundColor: accentColor, pointRadius: 0, pointHoverRadius: 0, }, @@ -640,15 +580,10 @@ max: 5, ticks: { stepSize: 1, - color: getComputedStyle( - document.documentElement, - ).getPropertyValue("--text-secondary"), + color: accentColor, }, grid: { - color: - getComputedStyle(document.documentElement).getPropertyValue( - "--text-teritary", - ) + "20", + color: accentColor + "20", lineWidth: 1, borderDash: [5, 5], }, diff --git a/manifest.json b/manifest.json index c7a0fa0..281b9b9 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Firxa", - "version": "1.4.1", + "version": "1.4.2", "description": "KRÉTA webes verziójának újraírása", "icons": { "128": "images/firka_logo_128.png" diff --git a/manifest_fox.json b/manifest_fox.json index 2940498..72706a1 100644 --- a/manifest_fox.json +++ b/manifest_fox.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Firxa", - "version": "1.4.1", + "version": "1.4.2", "description": "KRÉTA webes verziójának újraírása", "icons": { "128": "images/firka_logo_128.png"