Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: move env into src for better build * chore: removed unused things from webviews * feat: a better "defaults" - material-theme.config.json * chore: fix paths for scripts * feat: new folder "core" with managers * chore: cleanup all useless things * chore: update messages to be messages * refactor: new setAccent command and better material.theme.config entry
- Loading branch information
1 parent
1ddcebf
commit 72a12df
Showing
38 changed files
with
422 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ node_modules/ | |
/ui/ | ||
build | ||
dist | ||
user.material-theme.config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"accents": { | ||
"Acid Lime": "#C6FF00", | ||
"Blue": "#2979FF", | ||
"Breaking Bad": "#388E3C", | ||
"Bright Teal": "#64FFDA", | ||
"Cyan": "#00BCD4", | ||
"Graphite": "#616161", | ||
"Indigo": "#5C6BC0", | ||
"Lime": "#7CB342", | ||
"Orange": "#FF7042", | ||
"Pink": "#FF4081", | ||
"Purple": "#AB47BC", | ||
"Red": "#E57373", | ||
"Sky": "#84FFFF", | ||
"Tomato": "#F44336", | ||
"Teal": "#80CBC4", | ||
"Yellow": "#FFA000" | ||
}, | ||
"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 | ||
}, | ||
"editorWidget.resizeBorder": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"editorWidget.border": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"settings.modifiedItemIndicator": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"settings.headerForeground": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"panelTitle.activeBorder": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"breadcrumb.activeSelectionForeground": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"menu.selectionForeground": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"menubar.selectionForeground": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"editor.findMatchBorder": { | ||
"alpha": 100, | ||
"value": null | ||
}, | ||
"selection.background": { | ||
"alpha": 40, | ||
"value": null | ||
} | ||
}, | ||
"changelog": { | ||
"lastversion": "30.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export {default as accentsSetter} from './accents-setter'; | ||
export {default as accentsQuickPick} from './accents-setter/quick-pick'; | ||
export {command as setAccent} from './set-accent'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {workspace, window} from 'vscode'; | ||
import {extensionManager} from '../core/extension-manager'; | ||
import {settingsManager} from '../core/settings-manager'; | ||
|
||
const PURGE_KEY = 'Remove accents'; | ||
|
||
const isValidColor = (color: string | null | undefined): boolean => | ||
color && /^#([0-9A-F]{6}|[0-9A-F]{8})$/i.test(color); | ||
|
||
const getThemeColorCustomizationsConfig = (accentColor?: string): Record<string, unknown> => { | ||
const {accentsProperties} = extensionManager.getConfig(); | ||
const color = isValidColor(accentColor) ? accentColor : undefined; | ||
|
||
const themeColorCustomConfig = Object.keys(accentsProperties).reduce((acc: any, propName) => { | ||
const currentProp = accentsProperties[propName]; | ||
const shouldModify = color && currentProp.alpha < 100; | ||
const colorProp = shouldModify ? `${color}${currentProp.alpha > 10 ? currentProp.alpha : `0${currentProp.alpha}`}` : color; | ||
acc[propName] = colorProp; | ||
return acc; | ||
}, {}); | ||
|
||
return themeColorCustomConfig; | ||
}; | ||
|
||
const updateColorCustomizationsConfig = async (config: any): Promise<boolean> => { | ||
try { | ||
workspace.getConfiguration().update('workbench.colorCustomizations', config, true); | ||
return true; | ||
} catch (error) { | ||
window.showErrorMessage(error); | ||
} | ||
}; | ||
|
||
const quickPick = async (): Promise<string> => { | ||
const themeConfig = extensionManager.getConfig(); | ||
const options: string[] = Object.keys(themeConfig.accents).concat(PURGE_KEY); | ||
return window.showQuickPick(options); | ||
}; | ||
|
||
export const command = async (): Promise<void> => { | ||
const themeConfig = extensionManager.getConfig(); | ||
const currentColorCustomizationsConfig: any = workspace.getConfiguration().get('workbench.colorCustomizations'); | ||
const accent = await quickPick(); | ||
|
||
const config = accent === PURGE_KEY ? { | ||
...currentColorCustomizationsConfig, | ||
...getThemeColorCustomizationsConfig() | ||
} : { | ||
...currentColorCustomizationsConfig, | ||
...getThemeColorCustomizationsConfig(themeConfig.accents[accent]) | ||
}; | ||
|
||
await updateColorCustomizationsConfig(config); | ||
await settingsManager.updateSetting('accent', accent); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {window} from 'vscode'; | ||
import {MESSAGES} from '../helpers/messages'; | ||
|
||
type AskMessage = { | ||
message: string; | ||
options: { | ||
ok: string; | ||
cancel: string; | ||
}; | ||
}; | ||
|
||
class ChangelogManager { | ||
private readonly askMessage: AskMessage; | ||
|
||
constructor(message: AskMessage) { | ||
this.askMessage = message; | ||
} | ||
|
||
async askShowChangelog(): Promise<boolean> { | ||
return await window.showInformationMessage( | ||
this.askMessage.message, | ||
this.askMessage.options.ok, | ||
this.askMessage.options.cancel | ||
) === this.askMessage.options.ok; | ||
} | ||
} | ||
|
||
export const changelogManager = new ChangelogManager(MESSAGES.CHANGELOG); |
Oops, something went wrong.