mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 01:16:01 +00:00
change theme from command palette
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
import { currentTheme } from '../stores';
|
||||
import registerCommand from './registerCommand';
|
||||
import { get } from 'svelte/store';
|
||||
|
||||
function themeCommand(text, css) {
|
||||
return {
|
||||
text: text,
|
||||
onClick: () => currentTheme.set(css),
|
||||
// onPreview: () => {
|
||||
// const old = get(currentTheme);
|
||||
// currentTheme.set(css);
|
||||
// return ok => {
|
||||
// if (!ok) currentTheme.set(old);
|
||||
// };
|
||||
// },
|
||||
};
|
||||
}
|
||||
|
||||
registerCommand({
|
||||
id: 'theme.changeTheme',
|
||||
text: 'Theme: Change',
|
||||
getSubCommands: () => [
|
||||
{
|
||||
text: 'Light',
|
||||
onClick: () => currentTheme.set('theme-light'),
|
||||
},
|
||||
{
|
||||
text: 'Dark',
|
||||
onClick: () => currentTheme.set('theme-dark'),
|
||||
},
|
||||
],
|
||||
getSubCommands: () => [themeCommand('Light', 'theme-light'), themeCommand('Dark', 'theme-dark')],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user