diff --git a/extensions/commands/accents-setter/index.ts b/extensions/commands/accents-setter/index.ts index b3e72f8..0f65c32 100644 --- a/extensions/commands/accents-setter/index.ts +++ b/extensions/commands/accents-setter/index.ts @@ -1,85 +1,19 @@ import * as vscode from 'vscode'; -import {IAccentCustomProperty} from './../../interfaces/iaccent-custom-property'; -import {IGenericObject} from './../../interfaces/igeneric-object'; -import { - updateAccent, -} from './../../helpers/settings'; -import {getDefaultValues} from './../../helpers/fs'; +import {updateAccent} from './../../helpers/settings'; +import {getDefaultValues, getAccentsProperties} from './../../helpers/fs'; const REGEXP_HEX: RegExp = /^#([0-9A-F]{6}|[0-9A-F]{8})$/i; -const accentsProperties: IGenericObject = { - 'activityBarBadge.background': { - alpha: 100, - value: undefined - }, - 'list.activeSelectionForeground': { - alpha: 100, - value: undefined - }, - 'list.inactiveSelectionForeground': { - alpha: 100, - value: undefined - }, - 'list.highlightForeground': { - alpha: 100, - value: undefined - }, - 'scrollbarSlider.activeBackground': { - alpha: 50, - value: undefined - }, - 'editorSuggestWidget.highlightForeground': { - alpha: 100, - value: undefined - }, - 'textLink.foreground': { - alpha: 100, - value: undefined - }, - 'progressBar.background': { - alpha: 100, - value: undefined - }, - 'pickerGroup.foreground': { - alpha: 100, - value: undefined - }, - 'tab.activeBorder': { - alpha: 100, - value: undefined - }, - 'notificationLink.foreground': { - alpha: 100, - value: undefined - }, - 'editor.findWidgetResizeBorder': { - alpha: 100, - value: undefined - }, - 'editorWidget.border': { - alpha: 100, - value: undefined - }, - 'settings.modifiedItemForeground': { - alpha: 100, - value: undefined - }, - 'panelTitle.activeBorder': { - alpha: 100, - value: undefined - } -}; - /** * Assigns colours */ const assignColorCustomizations = (colour: string, config: any): void => { + const accentsProperties = getAccentsProperties(); const newColour = isValidColour(colour) ? colour : undefined; Object.keys(accentsProperties).forEach(propertyName => { - const accent: IAccentCustomProperty = accentsProperties[propertyName]; + const accent = accentsProperties[propertyName]; let colorProp = newColour; if (colour && accent.alpha < 100) { @@ -118,7 +52,7 @@ export default async (): Promise => { const accentSelected = await vscode.window.showQuickPick(options); if (accentSelected === null || accentSelected === undefined) { - Promise.resolve(null); + return Promise.resolve(null); } const config: any = vscode.workspace.getConfiguration().get('workbench.colorCustomizations'); diff --git a/extensions/defaults.json b/extensions/defaults.json index 17945e4..29bd12f 100644 --- a/extensions/defaults.json +++ b/extensions/defaults.json @@ -36,8 +36,70 @@ "_folder_dist_open", "_folder_ci_open" ], + "accentsProperties": { + "activityBarBadge.background": { + "alpha": 100, + "value": null + }, + "list.activeSelectionForeground": { + "alpha": 100, + "value": null + }, + "list.inactiveSelectionForeground": { + "alpha": 100, + "value": null + }, + "list.highlightForeground": { + "alpha": 100, + "value": null + }, + "scrollbarSlider.activeBackground": { + "alpha": 50, + "value": null + }, + "editorSuggestWidget.highlightForeground": { + "alpha": 100, + "value": null + }, + "textLink.foreground": { + "alpha": 100, + "value": null + }, + "progressBar.background": { + "alpha": 100, + "value": null + }, + "pickerGroup.foreground": { + "alpha": 100, + "value": null + }, + "tab.activeBorder": { + "alpha": 100, + "value": null + }, + "notificationLink.foreground": { + "alpha": 100, + "value": null + }, + "editor.findWidgetResizeBorder": { + "alpha": 100, + "value": null + }, + "editorWidget.border": { + "alpha": 100, + "value": null + }, + "settings.modifiedItemForeground": { + "alpha": 100, + "value": null + }, + "panelTitle.activeBorder": { + "alpha": 100, + "value": null + } + }, "changelog": { - "lastversion": "2.0.1" + "lastversion": "2.1.0" }, "icons": { "theme": { diff --git a/extensions/helpers/fs.ts b/extensions/helpers/fs.ts index 688baea..9dca63b 100644 --- a/extensions/helpers/fs.ts +++ b/extensions/helpers/fs.ts @@ -36,6 +36,10 @@ export function getVariantIcons(): string[] { return getDefaultValues().variantsIcons; } +export function getAccentsProperties() { + return getDefaultValues().accentsProperties; +} + /** * Gets a theme content by a given contribute ID */ diff --git a/extensions/interfaces/idefaults.ts b/extensions/interfaces/idefaults.ts index 799799e..3301e5a 100644 --- a/extensions/interfaces/idefaults.ts +++ b/extensions/interfaces/idefaults.ts @@ -1,5 +1,9 @@ +import {IGenericObject} from './igeneric-object'; +import {IAccentCustomProperty} from './iaccent-custom-property'; + export interface IDefaults { accents: IAccents; + accentsProperties: IGenericObject ; accentableIcons: string[]; changelog: IChangelog; icons: IDefaultsThemeIcons;