diff options
author | Ninette Adhikari <ninette@thehoodiefirm.com> | 2024-05-03 16:43:40 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-05-15 16:39:19 +0100 |
commit | cf0c866b51cc7d64b7a24fab21c8acd6324f9c1f (patch) | |
tree | 47ed55e044daccc95741e0b8a4c636234c976763 | |
parent | 20fafa08540b089f1b100e00108939c3c59bd448 (diff) | |
download | poky-cf0c866b51cc7d64b7a24fab21c8acd6324f9c1f.tar.gz |
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 <ninette@thehoodiefirm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/build_perf/html/measurement_chart.html | 15 | ||||
-rw-r--r-- | scripts/lib/build_perf/html/report.html | 34 |
2 files changed, 39 insertions, 10 deletions
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 @@ | |||
81 | 81 | ||
82 | // Draw chart | 82 | // Draw chart |
83 | const chart_div = document.getElementById('{{ chart_elem_id }}'); | 83 | const chart_div = document.getElementById('{{ chart_elem_id }}'); |
84 | const measurement_chart= echarts.init(chart_div, null, { | 84 | // Set dark mode |
85 | height: 320 | 85 | let measurement_chart |
86 | }); | 86 | if (window.matchMedia('(prefers-color-scheme: dark)').matches) { |
87 | measurement_chart= echarts.init(chart_div, 'dark', { | ||
88 | height: 320 | ||
89 | }); | ||
90 | } else { | ||
91 | measurement_chart= echarts.init(chart_div, null, { | ||
92 | height: 320 | ||
93 | }); | ||
94 | } | ||
87 | // Change chart size with browser resize | 95 | // Change chart size with browser resize |
88 | window.addEventListener('resize', function() { | 96 | window.addEventListener('resize', function() { |
89 | measurement_chart.resize(); | 97 | measurement_chart.resize(); |
90 | }); | 98 | }); |
91 | measurement_chart.setOption(option); | 99 | measurement_chart.setOption(option); |
92 | </script> | 100 | </script> |
93 | |||
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 @@ | |||
19 | 19 | ||
20 | {# Styles #} | 20 | {# Styles #} |
21 | <style> | 21 | <style> |
22 | :root { | ||
23 | --text: #000; | ||
24 | --bg: #fff; | ||
25 | --h2heading: #707070; | ||
26 | --link: #0000EE; | ||
27 | --trtopborder: #9ca3af; | ||
28 | --trborder: #e5e7eb; | ||
29 | --chartborder: #f0f0f0; | ||
30 | } | ||
22 | .meta-table { | 31 | .meta-table { |
23 | font-size: 14px; | 32 | font-size: 14px; |
24 | text-align: left; | 33 | text-align: left; |
@@ -31,7 +40,7 @@ | |||
31 | } | 40 | } |
32 | .measurement { | 41 | .measurement { |
33 | padding: 8px 0px 8px 8px; | 42 | padding: 8px 0px 8px 8px; |
34 | border: 2px solid #f0f0f0; | 43 | border: 2px solid var(--chartborder); |
35 | margin: 1.5rem 0; | 44 | margin: 1.5rem 0; |
36 | } | 45 | } |
37 | .details { | 46 | .details { |
@@ -61,6 +70,8 @@ | |||
61 | body { | 70 | body { |
62 | font-family: 'Helvetica', sans-serif; | 71 | font-family: 'Helvetica', sans-serif; |
63 | margin: 3rem 8rem; | 72 | margin: 3rem 8rem; |
73 | background-color: var(--bg); | ||
74 | color: var(--text); | ||
64 | } | 75 | } |
65 | h1 { | 76 | h1 { |
66 | text-align: center; | 77 | text-align: center; |
@@ -68,13 +79,13 @@ h1 { | |||
68 | h2 { | 79 | h2 { |
69 | font-size: 1.5rem; | 80 | font-size: 1.5rem; |
70 | margin-bottom: 0px; | 81 | margin-bottom: 0px; |
71 | color: #707070; | 82 | color: var(--h2heading); |
72 | padding-top: 1.5rem; | 83 | padding-top: 1.5rem; |
73 | } | 84 | } |
74 | h3 { | 85 | h3 { |
75 | font-size: 1.3rem; | 86 | font-size: 1.3rem; |
76 | margin: 0px; | 87 | margin: 0px; |
77 | color: #707070; | 88 | color: var(--h2heading); |
78 | padding: 1.5rem 0; | 89 | padding: 1.5rem 0; |
79 | } | 90 | } |
80 | h4 { | 91 | h4 { |
@@ -89,10 +100,10 @@ table { | |||
89 | line-height: 2rem; | 100 | line-height: 2rem; |
90 | } | 101 | } |
91 | tr { | 102 | tr { |
92 | border-bottom: 1px solid #e5e7eb; | 103 | border-bottom: 1px solid var(--trborder); |
93 | } | 104 | } |
94 | tr:first-child { | 105 | tr:first-child { |
95 | border-bottom: 1px solid #9ca3af; | 106 | border-bottom: 1px solid var(--trtopborder); |
96 | } | 107 | } |
97 | tr:last-child { | 108 | tr:last-child { |
98 | border-bottom: none; | 109 | border-bottom: none; |
@@ -100,11 +111,22 @@ tr:last-child { | |||
100 | a { | 111 | a { |
101 | text-decoration: none; | 112 | text-decoration: none; |
102 | font-weight: bold; | 113 | font-weight: bold; |
103 | color: #0000EE; | 114 | color: var(--link); |
104 | } | 115 | } |
105 | a:hover { | 116 | a:hover { |
106 | color: #8080ff; | 117 | color: #8080ff; |
107 | } | 118 | } |
119 | @media (prefers-color-scheme: dark) { | ||
120 | :root { | ||
121 | --text: #e9e8fa; | ||
122 | --bg: #0F0C28; | ||
123 | --h2heading: #B8B7CB; | ||
124 | --link: #87cefa; | ||
125 | --trtopborder: #394150; | ||
126 | --trborder: #212936; | ||
127 | --chartborder: #b1b0bf; | ||
128 | } | ||
129 | } | ||
108 | </style> | 130 | </style> |
109 | 131 | ||
110 | <title>{{ title }}</title> | 132 | <title>{{ title }}</title> |