diff --git a/src/core/i18n/index.ts b/src/core/i18n/index.ts index efeea3b..3ddf999 100644 --- a/src/core/i18n/index.ts +++ b/src/core/i18n/index.ts @@ -44,8 +44,8 @@ export function initFetchI18nStrings() { if (!_loadedLocale.has(resolvedLocale)) { _loadedLocale.add(resolvedLocale); - - fetch(`https://raw.githubusercontent.com/C0C0B01/i18n/main/resources/${resolvedLocale}/kettu.json`) + + fetch(`https://codeberg.org/cocobo1/kettu-i18n/src/branch/main/base/${resolvedLocale}.json`) .then(r => r.json()) .then(strings => _loadedStrings[resolvedLocale] = strings) .then(() => resolvedLocale === _lastSetLocale && (_currentLocale = resolvedLocale)) diff --git a/src/lib/addons/themes/colors/updater.ts b/src/lib/addons/themes/colors/updater.ts index c7b265b..8c3d85b 100644 --- a/src/lib/addons/themes/colors/updater.ts +++ b/src/lib/addons/themes/colors/updater.ts @@ -9,6 +9,7 @@ const origRawColor = { ...tokenRef.RawColor }; const AppearanceManager = findByPropsLazy("updateTheme"); const ThemeStore = findByStoreNameLazy("ThemeStore"); const FormDivider = findByPropsLazy("DIVIDER_COLORS"); +import { colorsPref } from "./preferences"; let _inc = 1; @@ -30,30 +31,42 @@ export const _colorRef: InternalColorRef = { export function updateBunnyColor(colorManifest: ColorManifest | null, { update = true } ) { if (settings.safeMode?.enabled) return; + const resolveType = (type = "dark") => (colorsPref.type ?? type) === "dark" ? "darker" : "light"; const internalDef = colorManifest ? parseColorManifest(colorManifest) : null; - const ref = Object.assign(_colorRef, { - current: internalDef, - key: `bn-theme-${++_inc}`, - lastSetDiscordTheme: !ThemeStore.theme.startsWith("bn-theme-") - ? ThemeStore.theme - : _colorRef.lastSetDiscordTheme - }); - if (internalDef != null) { - tokenRef.Theme[ref.key.toUpperCase()] = ref.key; - FormDivider.DIVIDER_COLORS[ref.key] = FormDivider.DIVIDER_COLORS[ref.current!.reference]; + if (resolveType() == "light" || update) { + var ref = Object.assign(_colorRef, { + current: internalDef, + key: `bn-theme-${++_inc}`, + lastSetDiscordTheme: !ThemeStore.theme.startsWith("bn-theme-") || !ThemeStore.theme.startsWith("darker") + ? ThemeStore.theme + : _colorRef.lastSetDiscordTheme + }); + } else { + var ref = Object.assign(_colorRef, { + current: internalDef, + key: `dark`, + lastSetDiscordTheme: !ThemeStore.theme.startsWith("bn-theme-") || !ThemeStore.theme.startsWith("darker") + ? ThemeStore.theme + : _colorRef.lastSetDiscordTheme + }); + } - Object.keys(tokenRef.Shadow).forEach(k => tokenRef.Shadow[k][ref.key] = tokenRef.Shadow[k][ref.current!.reference]); - Object.keys(tokenRef.SemanticColor).forEach(k => { - tokenRef.SemanticColor[k][ref.key] = { - ...tokenRef.SemanticColor[k][ref.current!.reference] - }; - }); - } + if (internalDef != null) { + tokenRef.Theme[ref.key.toUpperCase()] = ref.key; + FormDivider.DIVIDER_COLORS[ref.key] = FormDivider.DIVIDER_COLORS[ref.current!.reference]; + + Object.keys(tokenRef.Shadow).forEach(k => tokenRef.Shadow[k][ref.key] = tokenRef.Shadow[k][ref.current!.reference]); + Object.keys(tokenRef.SemanticColor).forEach(k => { + tokenRef.SemanticColor[k][ref.key] = { + ...tokenRef.SemanticColor[k][ref.current!.reference] + }; + }); + } if (update) { AppearanceManager.setShouldSyncAppearanceSettings(false); - AppearanceManager.updateTheme(internalDef != null ? ref.key : ref.lastSetDiscordTheme); + AppearanceManager.updateTheme(internalDef != null ? ref.key : "darker"); } }