@@ -4,6 +4,7 @@ import useSettingStore from "@/stores/setting";
44import { Store } from "@tauri-apps/plugin-store" ;
55import { useTranslations } from 'next-intl' ;
66import { useEffect } from "react" ;
7+ import { useTheme } from "next-themes" ;
78
89export function PreviewThemeSelect ( ) {
910 const t = useTranslations ( ) ;
@@ -46,10 +47,37 @@ export function PreviewThemeSelect() {
4647 )
4748}
4849
50+ export function AppThemeSelect ( ) {
51+ const t = useTranslations ( ) ;
52+ const { theme, setTheme } = useTheme ( )
53+
54+ const themes = [
55+ { value : 'light' , label : '亮色' } ,
56+ { value : 'dark' , label : '暗色' } ,
57+ { value : 'system' , label : '跟随系统' }
58+ ]
59+
60+ return (
61+ < Select onValueChange = { setTheme } value = { theme } >
62+ < SelectTrigger className = "w-[180px]" >
63+ < SelectValue placeholder = { t ( 'settings.theme.selectTheme' ) } />
64+ </ SelectTrigger >
65+ < SelectContent >
66+ {
67+ themes . map ( ( theme ) => (
68+ < SelectItem key = { theme . value } value = { theme . value } > { theme . label } </ SelectItem >
69+ ) )
70+ }
71+ </ SelectContent >
72+ </ Select >
73+ )
74+ }
75+
4976export function CodeThemeSelect ( ) {
5077 const t = useTranslations ( ) ;
5178 const { codeTheme, setCodeTheme } = useSettingStore ( )
52- const themes = [ 'github' , 'atom' , 'a11y' , 'gradient' , 'kimbie' , 'paraiso' , 'qtcreator' , 'stackoverflow' ]
79+
80+ const themes = [ 'github' , 'github-dark' , 'material-darker' , 'material-palenight' , 'one-dark' ]
5381
5482 async function changeHandler ( e : string ) {
5583 setCodeTheme ( e )
@@ -91,6 +119,10 @@ export function SettingTheme({id, icon}: {id: string, icon?: React.ReactNode}) {
91119
92120 return (
93121 < SettingType id = { id } icon = { icon } title = { t ( 'settings.theme.title' ) } >
122+ < SettingRow border >
123+ < span > { t ( 'settings.theme.appTheme' ) || '应用配色' } 。</ span >
124+ < AppThemeSelect />
125+ </ SettingRow >
94126 < SettingRow border >
95127 < span > { t ( 'settings.theme.previewTheme' ) } 。</ span >
96128 < PreviewThemeSelect />
0 commit comments