From: Ninette Adhikari Date: Fri, 3 May 2024 14:43:40 +0000 (+0200) Subject: oe-build-perf-report: Add dark mode X-Git-Tag: uninative-4.5~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed02a235d42202279ad5e4e3153247f9e5e2bba8;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git oe-build-perf-report: Add dark mode Update css to add dark mode when window prefers-color-scheme is dark. Signed-off-by: Ninette Adhikari Signed-off-by: Alexandre Belloni --- diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html index 7982ec39c22..ad4a93ed026 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 4cd240760a0..537ed3ee529 100644 --- a/scripts/lib/build_perf/html/report.html +++ b/scripts/lib/build_perf/html/report.html @@ -19,6 +19,15 @@ {# Styles #} {{ title }}