diff --git a/package.json b/package.json index 25cc74a..37fd021 100644 --- a/package.json +++ b/package.json @@ -347,6 +347,11 @@ "default": "", "description": "The Peacock color that will be applied to remote workspaces." }, + "peacock.sameRemoteLocalColor": { + "type": "boolean", + "default": false, + "description": "set same local color on setting remote color" + }, "peacock.showColorInStatusBar": { "type": "boolean", "default": true, @@ -440,4 +445,4 @@ "pre-commit": "npm run pretty" } } -} +} \ No newline at end of file diff --git a/src/configuration/read-configuration.ts b/src/configuration/read-configuration.ts index ec0d160..d469c75 100644 --- a/src/configuration/read-configuration.ts +++ b/src/configuration/read-configuration.ts @@ -225,6 +225,10 @@ export function getSurpriseMeOnStartup() { return readConfiguration(StandardSettings.SurpriseMeOnStartup, false); } +export function getSameRemoteLocalColor() { + return readConfiguration(StandardSettings.SameRemoteLocalColor, false); +} + export function getAffectedElements() { return { activityBar: readConfiguration(AffectedSettings.ActivityBar) || false, diff --git a/src/configuration/update-configuration.ts b/src/configuration/update-configuration.ts index 8a20a10..8b39e4d 100644 --- a/src/configuration/update-configuration.ts +++ b/src/configuration/update-configuration.ts @@ -13,7 +13,11 @@ import { isObjectEmpty, } from '../models'; import { Logger } from '../logging'; -import { getFavoriteColors, getColorCustomizationConfigFromWorkspace } from './read-configuration'; +import { + getFavoriteColors, + getColorCustomizationConfigFromWorkspace, + getSameRemoteLocalColor, +} from './read-configuration'; import { LiveShareSettings } from '../live-share'; export async function updateGlobalConfiguration(setting: AllSettings, value?: any) { @@ -120,16 +124,31 @@ export async function updatePeacockRemoteColorInUserSettings(color: string | und const section = `${extensionShortName}.${StandardSettings.RemoteColor}`; return await config.update(section, color, ConfigurationTarget.Global); } - +export async function updatePeacockColorOnly(color: string | undefined) { + const config = vscode.workspace.getConfiguration(); + const section = `${extensionShortName}.${StandardSettings.Color}`; + return await config.update(section, color, ConfigurationTarget.Workspace); +} +export async function updatePeacockRemoteColorOnly(color: string | undefined) { + const config = vscode.workspace.getConfiguration(); + const section = `${extensionShortName}.${StandardSettings.RemoteColor}`; + return await config.update(section, color, ConfigurationTarget.Workspace); +} export async function updatePeacockColor(color: string | undefined) { const config = vscode.workspace.getConfiguration(); const section = `${extensionShortName}.${StandardSettings.Color}`; + if (getSameRemoteLocalColor()) { + await updatePeacockRemoteColorOnly(color); + } return await config.update(section, color, ConfigurationTarget.Workspace); } export async function updatePeacockRemoteColor(color: string | undefined) { const config = vscode.workspace.getConfiguration(); const section = `${extensionShortName}.${StandardSettings.RemoteColor}`; + if (getSameRemoteLocalColor()) { + await updatePeacockColorOnly(color); + } return await config.update(section, color, ConfigurationTarget.Workspace); } diff --git a/src/models/enums.ts b/src/models/enums.ts index dc6ca7c..122fe82 100644 --- a/src/models/enums.ts +++ b/src/models/enums.ts @@ -10,6 +10,7 @@ export enum StandardSettings { KeepForegroundColor = 'keepForegroundColor', LightForegroundColor = 'lightForegroundColor', RemoteColor = 'remoteColor', + SameRemoteLocalColor = 'sameRemoteLocalColor', ShowColorInStatusBar = 'showColorInStatusBar', SurpriseMeFromFavoritesOnly = 'surpriseMeFromFavoritesOnly', SurpriseMeOnStartup = 'surpriseMeOnStartup',