mirror of
https://github.com/fmhy/edit.git
synced 2026-01-10 18:36:17 +00:00
@@ -13,11 +13,13 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
import { christmasTheme } from './christmas'
|
||||||
import { catppuccinTheme } from './catppuccin'
|
import { catppuccinTheme } from './catppuccin'
|
||||||
import type { ThemeRegistry } from '../types'
|
import type { ThemeRegistry } from '../types'
|
||||||
|
|
||||||
export const themeRegistry: ThemeRegistry = {
|
export const themeRegistry: ThemeRegistry = {
|
||||||
catppuccin: catppuccinTheme,
|
catppuccin: catppuccinTheme,
|
||||||
|
christmas: christmasTheme,
|
||||||
}
|
}
|
||||||
|
|
||||||
export { catppuccinTheme }
|
export { christmasTheme, catppuccinTheme }
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ const STORAGE_KEY_THEME_DATA = 'vitepress-theme-data'
|
|||||||
|
|
||||||
export class ThemeHandler {
|
export class ThemeHandler {
|
||||||
private state = ref<ThemeState>({
|
private state = ref<ThemeState>({
|
||||||
currentTheme: 'swarm',
|
currentTheme: 'christmas',
|
||||||
currentMode: 'light' as DisplayMode,
|
currentMode: 'light' as DisplayMode,
|
||||||
theme: themeRegistry.swarm
|
theme: themeRegistry.christmas
|
||||||
})
|
})
|
||||||
private amoledEnabled = ref(false)
|
private amoledEnabled = ref(false)
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ export class ThemeHandler {
|
|||||||
if (typeof window === 'undefined') return
|
if (typeof window === 'undefined') return
|
||||||
|
|
||||||
// Load saved preferences
|
// Load saved preferences
|
||||||
const savedTheme = localStorage.getItem(STORAGE_KEY_THEME) || 'swarm'
|
const savedTheme = localStorage.getItem(STORAGE_KEY_THEME) || 'christmas'
|
||||||
const savedMode = localStorage.getItem(STORAGE_KEY_MODE) as DisplayMode | null
|
const savedMode = localStorage.getItem(STORAGE_KEY_MODE) as DisplayMode | null
|
||||||
const savedAmoled = localStorage.getItem(STORAGE_KEY_AMOLED) === 'true'
|
const savedAmoled = localStorage.getItem(STORAGE_KEY_AMOLED) === 'true'
|
||||||
|
|
||||||
@@ -263,8 +263,8 @@ export class ThemeHandler {
|
|||||||
|
|
||||||
public setTheme(themeName: string) {
|
public setTheme(themeName: string) {
|
||||||
if (!themeRegistry[themeName]) {
|
if (!themeRegistry[themeName]) {
|
||||||
console.warn(`Theme "${themeName}" not found. Using swam theme.`)
|
console.warn(`Theme "${themeName}" not found. Using christmas theme.`)
|
||||||
themeName = 'swarm'
|
themeName = 'christmas'
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state.value.currentTheme = themeName
|
this.state.value.currentTheme = themeName
|
||||||
|
|||||||
Reference in New Issue
Block a user