Skip to content

Commit fa17317

Browse files
committed
Add a specific setting for DevTools theme
Fixes #1496. Currently light by default, but will change in future.
1 parent da076ad commit fa17317

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

‎package.json‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,16 @@
754754
"light"
755755
],
756756
"default": "dark",
757-
"description": "The theme to use for Dart DevTools and Icon previews in Hovers",
757+
"description": "The theme to use for Icon previews in Hovers. VS Code does not offer an API to check whether the current theme is Dart or Light so this must be configured manually.",
758+
"scope": "window"
759+
},
760+
"dart.devToolsTheme": {
761+
"enum": [
762+
"dark",
763+
"light"
764+
],
765+
"default": "light",
766+
"description": "The theme to use for Dart DevTools.",
758767
"scope": "window"
759768
},
760769
"dart.doNotFormat": {

‎src/config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class Config {
6363
get showTodos() { return this.getConfig<boolean>("showTodos"); }
6464
get showIgnoreQuickFixes() { return this.getConfig<boolean>("showIgnoreQuickFixes"); }
6565
get theme() { return this.getConfig<string>("theme"); }
66+
get devToolsTheme() { return this.getConfig<string>("devToolsTheme"); }
6667
get triggerSignatureHelpAutomatically() { return this.getConfig<boolean>("triggerSignatureHelpAutomatically"); }
6768
get warnWhenEditingFilesOutsideWorkspace() { return this.getConfig<boolean>("warnWhenEditingFilesOutsideWorkspace"); }
6869
public setWarnWhenEditingFilesOutsideWorkspace(value: boolean): Thenable<void> { return this.setConfig("warnWhenEditingFilesOutsideWorkspace", value, ConfigurationTarget.Global); }
@@ -78,6 +79,7 @@ class Config {
7879

7980
// Helpers
8081
get useDarkTheme() { return this.theme !== "light"; }
82+
get useDevToolsDarkTheme() { return this.devToolsTheme === "dark"; } // TODO: Change this to !== "light" when we want to flip default
8183

8284
public for(uri?: Uri): ResourceConfig {
8385
return new ResourceConfig(uri);

‎src/sdk/dev_tools.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as child_process from "child_process";
22
import * as path from "path";
33
import * as vs from "vscode";
44
import { Analytics } from "../analytics";
5+
import { config } from "../config";
56
import { LogCategory, LogSeverity } from "../debug/utils";
67
import { PubGlobal } from "../pub/global";
78
import { openInBrowser, Sdks } from "../utils";
@@ -50,9 +51,7 @@ export class DevTools implements vs.Disposable {
5051
}
5152
try {
5253
const url = await this.devtoolsUrl;
53-
// TODO: enable using Dark theme based on setting when we're happy with it.
54-
// const fullUrl = `${url}?hide=debugger&port=${observatoryPort}${config.useDarkTheme ? "&theme=dark" : ""}`;
55-
const fullUrl = `${url}?hide=debugger&port=${observatoryPort}`;
54+
const fullUrl = `${url}?hide=debugger&port=${observatoryPort}${config.useDevToolsDarkTheme ? "&theme=dark" : ""}`;
5655
this.devToolsStatusBarItem.text = "Dart DevTools";
5756
this.devToolsStatusBarItem.tooltip = `Dart DevTools is running at ${url}`;
5857
this.devToolsStatusBarItem.command = "dart.openDevTools";

0 commit comments

Comments
 (0)