theme moved to plugin

This commit is contained in:
Jan Prochazka
2021-02-26 16:52:22 +01:00
parent 8a0d10e50d
commit a101f21483
9 changed files with 136 additions and 108 deletions

View File

@@ -1,11 +1,12 @@
import { currentTheme } from '../stores';
import { currentTheme, extensions } from '../stores';
import registerCommand from './registerCommand';
import { get } from 'svelte/store';
import { ThemeDefinition } from 'dbgate-types';
function themeCommand(text, css) {
function themeCommand(theme: ThemeDefinition) {
return {
text: text,
onClick: () => currentTheme.set(css),
text: theme.themeName,
onClick: () => currentTheme.set(theme.className),
// onPreview: () => {
// const old = get(currentTheme);
// currentTheme.set(css);
@@ -19,5 +20,5 @@ function themeCommand(text, css) {
registerCommand({
id: 'theme.changeTheme',
text: 'Theme: Change',
getSubCommands: () => [themeCommand('Light', 'theme-light'), themeCommand('Dark', 'theme-dark')],
getSubCommands: () => get(extensions).themes.map(themeCommand),
});