impr: keep photon default theme with custom instance theme, close #541
This commit is contained in:
1 file changed
+44
-41
+44
-41
@@ -1,59 +1,62 @@
|
|||||||
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'
|
||||||
|
|
||||||
|
const PHOTON_DEFAULT = {
|
||||||
|
slate: {
|
||||||
|
25: '252 253 254',
|
||||||
|
50: '248 250 252',
|
||||||
|
100: '241 245 249',
|
||||||
|
200: '226 232 240',
|
||||||
|
300: '203 213 225',
|
||||||
|
400: '148 163 184',
|
||||||
|
500: '100 116 139',
|
||||||
|
600: '71 85 105',
|
||||||
|
700: '51 65 85',
|
||||||
|
800: '30 41 59',
|
||||||
|
900: '15 23 42',
|
||||||
|
950: '2 6 23',
|
||||||
|
},
|
||||||
|
zinc: {
|
||||||
|
'50': '252 252 254',
|
||||||
|
'100': '248 248 251',
|
||||||
|
'200': '235 235 240',
|
||||||
|
'300': '222 222 228',
|
||||||
|
'400': '175 175 185',
|
||||||
|
'500': '128 128 138',
|
||||||
|
'600': '98 98 108',
|
||||||
|
'700': '68 68 76',
|
||||||
|
'800': '47 47 54',
|
||||||
|
'900': '34 34 39',
|
||||||
|
'925': '28 28 32',
|
||||||
|
'950': '25 25 29',
|
||||||
|
},
|
||||||
|
primary: {
|
||||||
|
100: '241 245 249',
|
||||||
|
900: '15 23 42',
|
||||||
|
},
|
||||||
|
other: {
|
||||||
|
black: '0 0 0',
|
||||||
|
white: '255 255 255',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
export function getDefaultColors(): ThemeColors {
|
export function getDefaultColors(): ThemeColors {
|
||||||
return env.PUBLIC_THEME
|
return env.PUBLIC_THEME ? JSON.parse(env.PUBLIC_THEME) : PHOTON_DEFAULT
|
||||||
? JSON.parse(env.PUBLIC_THEME)
|
|
||||||
: {
|
|
||||||
slate: {
|
|
||||||
25: '252 253 254',
|
|
||||||
50: '248 250 252',
|
|
||||||
100: '241 245 249',
|
|
||||||
200: '226 232 240',
|
|
||||||
300: '203 213 225',
|
|
||||||
400: '148 163 184',
|
|
||||||
500: '100 116 139',
|
|
||||||
600: '71 85 105',
|
|
||||||
700: '51 65 85',
|
|
||||||
800: '30 41 59',
|
|
||||||
900: '15 23 42',
|
|
||||||
950: '2 6 23',
|
|
||||||
},
|
|
||||||
zinc: {
|
|
||||||
'50': '252 252 254',
|
|
||||||
'100': '248 248 251',
|
|
||||||
'200': '235 235 240',
|
|
||||||
'300': '222 222 228',
|
|
||||||
'400': '175 175 185',
|
|
||||||
'500': '128 128 138',
|
|
||||||
'600': '98 98 108',
|
|
||||||
'700': '68 68 76',
|
|
||||||
'800': '47 47 54',
|
|
||||||
'900': '34 34 39',
|
|
||||||
'925': '28 28 32',
|
|
||||||
'950': '25 25 29',
|
|
||||||
},
|
|
||||||
primary: {
|
|
||||||
100: '241 245 249',
|
|
||||||
900: '15 23 42',
|
|
||||||
},
|
|
||||||
other: {
|
|
||||||
black: '0 0 0',
|
|
||||||
white: '255 255 255',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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