Skip to content

Commit 8da4ba0

Browse files
paulirishDevtools-frontend LUCI CQ
authored andcommitted
Memory: Use system colors within heap snapshot overview canvas
Fixes poor contrast in dark mode. Bug:396430493 Change-Id: Iae9656dba5b59ee9a205e64d81927135ade4c0e6 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6265565 Auto-Submit: Paul Irish <[email protected]> Commit-Queue: Yang Guo <[email protected]> Reviewed-by: Yang Guo <[email protected]>
1 parent cbd8f50 commit 8da4ba0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

front_end/panels/profiler/HeapTimelineOverview.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import * as i18n from '../../core/i18n/i18n.js';
77
import * as Platform from '../../core/platform/platform.js';
88
import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
99
import * as UI from '../../ui/legacy/legacy.js';
10+
import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
1011
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
1112

1213
export class HeapTimelineOverview extends Common.ObjectWrapper.eventMixin<EventTypes, typeof UI.Widget.VBox>(
@@ -122,7 +123,7 @@ export class HeapTimelineOverview extends Common.ObjectWrapper.eventMixin<EventT
122123
if (this.running) {
123124
context.beginPath();
124125
context.lineWidth = 2;
125-
context.strokeStyle = 'rgba(192, 192, 192, 0.6)';
126+
context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--sys-color-neutral-outline');
126127
const currentX = (Date.now() - startTime) * scaleFactor;
127128
context.moveTo(currentX, height - 1);
128129
context.lineTo(currentX, 0);
@@ -146,7 +147,7 @@ export class HeapTimelineOverview extends Common.ObjectWrapper.eventMixin<EventT
146147
gridY = Math.round(height - gridValue * yScaleFactor - 0.5) + 0.5;
147148
context.beginPath();
148149
context.lineWidth = 1;
149-
context.strokeStyle = 'rgba(0, 0, 0, 0.2)';
150+
context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--sys-color-on-surface-subtle');
150151
context.moveTo(0, gridY);
151152
context.lineTo(width, gridY);
152153
context.stroke();
@@ -160,14 +161,14 @@ export class HeapTimelineOverview extends Common.ObjectWrapper.eventMixin<EventT
160161

161162
context.beginPath();
162163
context.lineWidth = 2;
163-
context.strokeStyle = 'rgba(192, 192, 192, 0.6)';
164+
context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--sys-color-neutral-outline');
164165
aggregateAndCall(topSizes, drawBarCallback);
165166
context.stroke();
166167
context.closePath();
167168

168169
context.beginPath();
169170
context.lineWidth = 2;
170-
context.strokeStyle = 'rgba(0, 0, 192, 0.8)';
171+
context.strokeStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--sys-color-primary-bright');
171172
aggregateAndCall(sizes, drawBarCallback);
172173
context.stroke();
173174
context.closePath();
@@ -181,9 +182,10 @@ export class HeapTimelineOverview extends Common.ObjectWrapper.eventMixin<EventT
181182
context.beginPath();
182183
context.textBaseline = 'bottom';
183184
context.font = '10px ' + window.getComputedStyle(this.element, null).getPropertyValue('font-family');
184-
context.fillStyle = 'rgba(255, 255, 255, 0.75)';
185+
// Background behind text for better contrast. Some opacity so canvas can still bleed through
186+
context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background-opacity-80');
185187
context.fillRect(labelX, labelY - gridLabelHeight, labelWidth, gridLabelHeight);
186-
context.fillStyle = 'rgb(64, 64, 64)';
188+
context.fillStyle = ThemeSupport.ThemeSupport.instance().getComputedValue('--sys-color-on-surface-subtle');
187189
context.fillText(label, labelX + labelPadding, labelY);
188190
context.fill();
189191
context.closePath();

0 commit comments

Comments
 (0)