impr: keep photon default theme with custom instance theme, close #541

This commit is contained in:
James Xylight committed 2025-06-25 17:13:10 -07:00
1 parent 57d072f24c
commit d25cfc2be4
1 file changed
+9 -6
+9 -6
View File
@@ -1,10 +1,7 @@
import { env } from '$env/dynamic/public'
import type { Theme, ThemeColors } from './colors.svelte'
export function getDefaultColors(): ThemeColors {
return env.PUBLIC_THEME
? JSON.parse(env.PUBLIC_THEME)
: {
const PHOTON_DEFAULT = {
slate: {
25: '252 253 254',
50: '248 250 252',
@@ -41,19 +38,25 @@ export function getDefaultColors(): ThemeColors {
black: '0 0 0',
white: '255 255 255',
},
}
}
export function getDefaultColors(): ThemeColors {
return env.PUBLIC_THEME ? JSON.parse(env.PUBLIC_THEME) : PHOTON_DEFAULT
}
export function getDefaultTheme(): Theme {
return {
id: 0,
colors: getDefaultColors(),
name: 'Default',
name: env.PUBLIC_THEME ? 'Instance Default' : 'Mono',
}
}
export const presets: Theme[] = [
getDefaultTheme(),
...(env.PUBLIC_THEME
? [{ colors: PHOTON_DEFAULT, id: -10, name: 'Mono' }]
: []),
{
colors: {
slate: {