impr: keep photon default theme with custom instance theme, close #541
This commit is contained in:
1 file changed
+9
-6
@@ -1,10 +1,7 @@
|
|||||||
import { env } from '$env/dynamic/public'
|
import { env } from '$env/dynamic/public'
|
||||||
import type { Theme, ThemeColors } from './colors.svelte'
|
import type { Theme, ThemeColors } from './colors.svelte'
|
||||||
|
|
||||||
export function getDefaultColors(): ThemeColors {
|
const PHOTON_DEFAULT = {
|
||||||
return env.PUBLIC_THEME
|
|
||||||
? JSON.parse(env.PUBLIC_THEME)
|
|
||||||
: {
|
|
||||||
slate: {
|
slate: {
|
||||||
25: '252 253 254',
|
25: '252 253 254',
|
||||||
50: '248 250 252',
|
50: '248 250 252',
|
||||||
@@ -41,19 +38,25 @@ export function getDefaultColors(): ThemeColors {
|
|||||||
black: '0 0 0',
|
black: '0 0 0',
|
||||||
white: '255 255 255',
|
white: '255 255 255',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDefaultColors(): ThemeColors {
|
||||||
|
return env.PUBLIC_THEME ? JSON.parse(env.PUBLIC_THEME) : PHOTON_DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDefaultTheme(): Theme {
|
export function getDefaultTheme(): Theme {
|
||||||
return {
|
return {
|
||||||
id: 0,
|
id: 0,
|
||||||
colors: getDefaultColors(),
|
colors: getDefaultColors(),
|
||||||
name: 'Default',
|
name: env.PUBLIC_THEME ? 'Instance Default' : 'Mono',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const presets: Theme[] = [
|
export const presets: Theme[] = [
|
||||||
getDefaultTheme(),
|
getDefaultTheme(),
|
||||||
|
...(env.PUBLIC_THEME
|
||||||
|
? [{ colors: PHOTON_DEFAULT, id: -10, name: 'Mono' }]
|
||||||
|
: []),
|
||||||
{
|
{
|
||||||
colors: {
|
colors: {
|
||||||
slate: {
|
slate: {
|
||||||
|
|||||||
Reference in new issue
Block a user