diff --git a/package.json b/package.json index 74e1758de..e5a224b2c 100644 --- a/package.json +++ b/package.json @@ -213,36 +213,72 @@ "type": "object", "description": "Configuration for custom coloring of the statusbar.", "properties": { - "disconnectedColor": { - "type": "string", - "default": "#c0c0c0", - "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", - "description": "Foreground color for the disconnected status" - }, - "launchingColor": { - "type": "string", - "default": "#fdd023", - "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", - "description": "Foreground color for the launching status" - }, - "connectedStatusColor": { - "type": "string", - "default": "#fdd023", - "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", - "description": "Foreground color for the connected status" + "light": { + "type": "object", + "description": "Light theme colors", + "properties": { + "disconnectedColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the disconnected status" + }, + "launchingColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the launching status" + }, + "connectedStatusColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the connected status" + }, + "typeStatusColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the type status" + } + } }, - "typeStatusColor": { - "type": "string", - "default": "#91dc47", - "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", - "description": "Foreground color for the type status" + "dark": { + "type": "object", + "description": "Dark theme colors", + "properties": { + "disconnectedColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the disconnected status" + }, + "launchingColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the launching status" + }, + "connectedStatusColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the connected status" + }, + "typeStatusColor": { + "type": "string", + "pattern": "#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})", + "description": "Foreground color for the type status" + } + } } }, "default": { - "disconnectedColor": "#c0c0c0", - "launchingColor": "#fdd023", - "connectedStatusColor": "#fdd023", - "typeStatusColor": "#91dc47" + "light": { + "disconnectedColor": "#777777", + "launchingColor": "#000000", + "connectedStatusColor": "#DB9550", + "typeStatusColor": "#91dc47" + }, + "dark": { + "disconnectedColor": "#aaaaaa", + "launchingColor": "#ffffff", + "connectedStatusColor": "#DB9550", + "typeStatusColor": "#91dc47" + } } }, "calva.customCljsRepl": { @@ -2453,4 +2489,4 @@ "webpack": "^5.27.1", "webpack-cli": "^4.5.0" } -} +} \ No newline at end of file diff --git a/src/statusbar.ts b/src/statusbar.ts index c5b81a02c..65c2204ee 100644 --- a/src/statusbar.ts +++ b/src/statusbar.ts @@ -15,6 +15,12 @@ const color = { inactive: "#b3b3b3" }; +// get theme kind once +//console.log(vscode.window.activeColorTheme.kind === vscode.ColorThemeKind.Light ? 'light' : 'dark/hc'); +// event +//vscode.window.onDidChangeActiveColorTheme(e => { +// console.log(e.kind === ColorThemeKind.Light ? 'light' : 'dark/hc'); +//}); function colorValue(section: string, currentConf: vscode.WorkspaceConfiguration): string { let { defaultValue, globalValue, workspaceFolderValue, workspaceValue } = currentConf.inspect(section); return (workspaceFolderValue || workspaceValue || globalValue || defaultValue) as string; @@ -22,7 +28,9 @@ function colorValue(section: string, currentConf: vscode.WorkspaceConfiguration) function update(context = state.extensionContext) { - let currentConf = vscode.workspace.getConfiguration('calva.statusColor'); + let currentConf = vscode.workspace.getConfiguration(`calva.statusColor.${ + vscode.window.activeColorTheme.kind === vscode.ColorThemeKind.Light ? 'light' : 'dark' + }`); let doc = util.getDocument({}), fileType = util.getFileType(doc), @@ -54,7 +62,7 @@ function update(context = state.extensionContext) { cljsBuildStatus.tooltip = null; if (getStateValue('connected')) { - connectionStatus.text = "nREPL $(zap)"; + connectionStatus.text = "REPL $(zap)"; connectionStatus.color = colorValue("connectedStatusColor", currentConf); connectionStatus.tooltip = `nrepl://${getStateValue('hostname')}:${getStateValue('port')} (Click to reset connection)`; connectionStatus.command = "calva.startOrConnectRepl"; @@ -84,11 +92,11 @@ function update(context = state.extensionContext) { connectionStatus.tooltip = "Click to interrupt jack-in or Connect to REPL Server"; connectionStatus.command = "calva.disconnect"; } else if (util.getConnectingState()) { - connectionStatus.text = "nREPL - trying to connect"; + connectionStatus.text = "REPL - trying to connect"; connectionStatus.tooltip = "Click to interrupt jack-in or Connect to REPL Server"; connectionStatus.command = "calva.disconnect"; } else { - connectionStatus.text = "nREPL $(zap)"; + connectionStatus.text = "REPL $(zap)"; connectionStatus.tooltip = "Click to jack-in or Connect to REPL Server"; connectionStatus.color = colorValue("disconnectedColor", currentConf); connectionStatus.command = "calva.startOrConnectRepl";