From cf0c866b51cc7d64b7a24fab21c8acd6324f9c1f Mon Sep 17 00:00:00 2001 From: Ninette Adhikari Date: Fri, 3 May 2024 16:43:40 +0200 Subject: oe-build-perf-report: Add dark mode Update css to add dark mode when window prefers-color-scheme is dark. (From OE-Core rev: ed02a235d42202279ad5e4e3153247f9e5e2bba8) Signed-off-by: Ninette Adhikari Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- scripts/lib/build_perf/html/measurement_chart.html | 15 +++++++--- scripts/lib/build_perf/html/report.html | 34 ++++++++++++++++++---- 2 files changed, 39 insertions(+), 10 deletions(-) (limited to 'scripts/lib/build_perf/html') diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html index 7982ec39c2..ad4a93ed02 100644 --- a/scripts/lib/build_perf/html/measurement_chart.html +++ b/scripts/lib/build_perf/html/measurement_chart.html @@ -81,13 +81,20 @@ // Draw chart const chart_div = document.getElementById('{{ chart_elem_id }}'); - const measurement_chart= echarts.init(chart_div, null, { - height: 320 - }); + // Set dark mode + let measurement_chart + if (window.matchMedia('(prefers-color-scheme: dark)').matches) { + measurement_chart= echarts.init(chart_div, 'dark', { + height: 320 + }); + } else { + measurement_chart= echarts.init(chart_div, null, { + height: 320 + }); + } // Change chart size with browser resize window.addEventListener('resize', function() { measurement_chart.resize(); }); measurement_chart.setOption(option); - diff --git a/scripts/lib/build_perf/html/report.html b/scripts/lib/build_perf/html/report.html index 4cd240760a..537ed3ee52 100644 --- a/scripts/lib/build_perf/html/report.html +++ b/scripts/lib/build_perf/html/report.html @@ -19,6 +19,15 @@ {# Styles #} {{ title }} -- cgit v1.2.3-54-g00ecf