Fix/accents props (#214)

* chore: accentsProperties on defaults.json

* chore: small fix accents-setter
This commit is contained in:
Alessio Occhipinti 2018-06-28 23:26:07 +02:00 committed by Mattia Astorino
parent 729dbe3b29
commit f2e7be321d
4 changed files with 76 additions and 72 deletions

View file

@ -1,85 +1,19 @@
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import {IAccentCustomProperty} from './../../interfaces/iaccent-custom-property'; import {updateAccent} from './../../helpers/settings';
import {IGenericObject} from './../../interfaces/igeneric-object'; import {getDefaultValues, getAccentsProperties} from './../../helpers/fs';
import {
updateAccent,
} from './../../helpers/settings';
import {getDefaultValues} from './../../helpers/fs';
const REGEXP_HEX: RegExp = /^#([0-9A-F]{6}|[0-9A-F]{8})$/i; const REGEXP_HEX: RegExp = /^#([0-9A-F]{6}|[0-9A-F]{8})$/i;
const accentsProperties: IGenericObject <IAccentCustomProperty> = {
'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 * Assigns colours
*/ */
const assignColorCustomizations = (colour: string, config: any): void => { const assignColorCustomizations = (colour: string, config: any): void => {
const accentsProperties = getAccentsProperties();
const newColour = isValidColour(colour) ? colour : undefined; const newColour = isValidColour(colour) ? colour : undefined;
Object.keys(accentsProperties).forEach(propertyName => { Object.keys(accentsProperties).forEach(propertyName => {
const accent: IAccentCustomProperty = accentsProperties[propertyName]; const accent = accentsProperties[propertyName];
let colorProp = newColour; let colorProp = newColour;
if (colour && accent.alpha < 100) { if (colour && accent.alpha < 100) {
@ -118,7 +52,7 @@ export default async (): Promise<boolean> => {
const accentSelected = await vscode.window.showQuickPick(options); const accentSelected = await vscode.window.showQuickPick(options);
if (accentSelected === null || accentSelected === undefined) { if (accentSelected === null || accentSelected === undefined) {
Promise.resolve(null); return Promise.resolve(null);
} }
const config: any = vscode.workspace.getConfiguration().get('workbench.colorCustomizations'); const config: any = vscode.workspace.getConfiguration().get('workbench.colorCustomizations');

View file

@ -36,8 +36,70 @@
"_folder_dist_open", "_folder_dist_open",
"_folder_ci_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": { "changelog": {
"lastversion": "2.0.1" "lastversion": "2.1.0"
}, },
"icons": { "icons": {
"theme": { "theme": {

View file

@ -36,6 +36,10 @@ export function getVariantIcons(): string[] {
return getDefaultValues().variantsIcons; return getDefaultValues().variantsIcons;
} }
export function getAccentsProperties() {
return getDefaultValues().accentsProperties;
}
/** /**
* Gets a theme content by a given contribute ID * Gets a theme content by a given contribute ID
*/ */

View file

@ -1,5 +1,9 @@
import {IGenericObject} from './igeneric-object';
import {IAccentCustomProperty} from './iaccent-custom-property';
export interface IDefaults { export interface IDefaults {
accents: IAccents; accents: IAccents;
accentsProperties: IGenericObject <IAccentCustomProperty>;
accentableIcons: string[]; accentableIcons: string[];
changelog: IChangelog; changelog: IChangelog;
icons: IDefaultsThemeIcons; icons: IDefaultsThemeIcons;