48 lines
1.5 KiB
Plaintext
48 lines
1.5 KiB
Plaintext
import { Palette } from "../_imports/coop-widgets.slint";
|
|
import { StyleMetrics } from "std-widgets.slint";
|
|
|
|
export struct ColorPalette {
|
|
background: brush,
|
|
background-alt: brush,
|
|
foreground: brush,
|
|
foreground-disabled: brush,
|
|
surface: brush,
|
|
surface-disabled: brush,
|
|
on-surface: brush,
|
|
primary: brush,
|
|
on-primary: brush,
|
|
border: brush,
|
|
border-disabled: brush,
|
|
shadow: brush,
|
|
error: brush,
|
|
accent: brush,
|
|
on-accent: brush,
|
|
}
|
|
|
|
export global ThemeSettings {
|
|
in-out property <bool> dark-color-scheme: StyleMetrics.dark-color-scheme;
|
|
in-out property <ColorPalette> color_palette;
|
|
in-out property <bool> built-in-theme;
|
|
in-out property <int> color_index: 2;
|
|
}
|
|
|
|
export global ThemeSwitcher {
|
|
public function switch(palette: ColorPalette) {
|
|
Palette.background = palette.background;
|
|
Palette.background-alt = palette.background-alt;
|
|
Palette.foreground = palette.foreground;
|
|
Palette.foreground-disabled = palette.foreground-disabled;
|
|
Palette.surface = palette.surface;
|
|
Palette.surface-disabled = palette.surface-disabled;
|
|
Palette.on-surface = palette.on-surface;
|
|
Palette.primary = palette.primary;
|
|
Palette.on-primary = palette.on-primary;
|
|
Palette.border = palette.border;
|
|
Palette.border-disabled = palette.border-disabled;
|
|
Palette.shadow = palette.shadow;
|
|
Palette.error = palette.error;
|
|
Palette.accent = palette.accent;
|
|
Palette.on-accent = palette.on-accent;
|
|
}
|
|
}
|