@@ -168,6 +168,78 @@ const THEME_COLOR_SWATCHES = [
168168
169169const THEME_NEUTRAL_SWATCHES = [ "#737373" , "#78716c" , "#64748b" , "#71717a" ] as const ;
170170
171+ type ThemeOption = ( typeof THEME_OPTIONS ) [ number ] ;
172+
173+ function ThemeModePreview ( {
174+ option,
175+ selected,
176+ accentColor,
177+ onSelect,
178+ } : {
179+ option : ThemeOption ;
180+ selected : boolean ;
181+ accentColor : string ;
182+ onSelect : ( ) => void ;
183+ } ) {
184+ const previewBackground =
185+ option . value === "system"
186+ ? "bg-[linear-gradient(to_right,#fafafa_0_50%,#18181b_50%)]"
187+ : option . value === "light"
188+ ? "bg-zinc-50"
189+ : "bg-zinc-900" ;
190+ const previewForeground = option . value === "light" ? "bg-zinc-400" : "bg-zinc-500" ;
191+ const cardBackground =
192+ option . value === "system"
193+ ? "bg-[linear-gradient(to_right,rgba(255,255,255,0.9)_0_32%,rgba(39,39,42,0.95)_32%)]"
194+ : option . value === "light"
195+ ? "bg-white/90"
196+ : "bg-zinc-800/95" ;
197+
198+ return (
199+ < button
200+ type = "button"
201+ aria-label = { `Use ${ option . label . toLowerCase ( ) } theme` }
202+ aria-pressed = { selected }
203+ className = "group min-w-0 cursor-pointer text-left"
204+ onClick = { onSelect }
205+ >
206+ < span
207+ className = { `relative block h-24 overflow-hidden rounded-xl border transition group-hover:border-primary/60 ${
208+ selected ? "border-primary ring-2 ring-primary/20" : "border-border"
209+ } ${ previewBackground } `}
210+ >
211+ < span className = "absolute inset-y-0 left-0 w-[31%] border-r border-black/10 bg-black/[0.04] dark:border-white/10" />
212+ < span
213+ className = "absolute top-4 left-3 h-1.5 w-8 rounded-full"
214+ style = { { backgroundColor : accentColor } }
215+ />
216+ < span className = { `absolute top-8 left-3 h-1 w-10 rounded-full ${ previewForeground } ` } />
217+ < span className = "absolute top-4 right-4 h-2 w-16 rounded-full bg-zinc-400/60" />
218+ < span
219+ className = { `absolute right-3 bottom-3 h-14 w-[60%] rounded-lg border border-black/10 shadow-sm ${ cardBackground } ` }
220+ >
221+ < span className = "absolute top-3 left-3 h-1.5 w-12 rounded-full bg-zinc-400/60" />
222+ < span className = "absolute top-7 left-3 h-1 w-[70%] rounded-full bg-zinc-400/30" />
223+ < span
224+ className = "absolute bottom-2 left-3 h-1.5 w-8 rounded-full"
225+ style = { { backgroundColor : accentColor } }
226+ />
227+ </ span >
228+ { option . value === "system" ? (
229+ < span className = "absolute inset-y-0 left-1/2 border-l border-white/50" />
230+ ) : null }
231+ </ span >
232+ < span
233+ className = { `mt-2 block text-center text-xs font-medium ${
234+ selected ? "text-foreground" : "text-muted-foreground"
235+ } `}
236+ >
237+ { option . label }
238+ </ span >
239+ </ button >
240+ ) ;
241+ }
242+
171243function ThemeColorControl ( {
172244 label,
173245 value,
@@ -1028,43 +1100,33 @@ export function AppearanceSettingsPanel() {
10281100 < SettingsSection id = "appearance" title = "Appearance" >
10291101 < SettingsRow
10301102 { ...searchableSetting ( "theme" ) }
1031- description = "Choose how T3 Code looks across the app ."
1103+ description = "Choose a mode with a quick preview of the workspace ."
10321104 resetAction = {
10331105 theme !== "system" ? (
10341106 < SettingResetButton label = "theme" onClick = { ( ) => setTheme ( "system" ) } />
10351107 ) : null
10361108 }
1037- control = {
1038- < Select
1039- value = { theme }
1040- onValueChange = { ( value ) => {
1041- if ( value === "system" || value === "light" || value === "dark" ) {
1042- setTheme ( value ) ;
1043- }
1044- } }
1045- >
1046- < SelectTrigger className = "w-full sm:w-40" aria-label = "Theme preference" >
1047- < SelectValue >
1048- { THEME_OPTIONS . find ( ( option ) => option . value === theme ) ?. label ?? "System" }
1049- </ SelectValue >
1050- </ SelectTrigger >
1051- < SelectPopup align = "end" alignItemWithTrigger = { false } >
1052- { THEME_OPTIONS . map ( ( option ) => (
1053- < SelectItem hideIndicator key = { option . value } value = { option . value } >
1054- { option . label }
1055- </ SelectItem >
1056- ) ) }
1057- </ SelectPopup >
1058- </ Select >
1059- }
1060- />
1109+ >
1110+ < div className = "mt-4 grid grid-cols-3 gap-3 pb-3" >
1111+ { THEME_OPTIONS . map ( ( option ) => (
1112+ < ThemeModePreview
1113+ key = { option . value }
1114+ option = { option }
1115+ selected = { theme === option . value }
1116+ accentColor = { colors . accentColor }
1117+ onSelect = { ( ) => setTheme ( option . value ) }
1118+ />
1119+ ) ) }
1120+ </ div >
1121+ </ SettingsRow >
10611122
10621123 < SettingsRow
10631124 { ...searchableSetting ( "theme-colors" ) }
1064- description = "Pick an accent and neutral tint. T3 Code generates the light and dark palettes from these two colors ."
1125+ description = "Pick two color seeds, then tune how strongly they separate surfaces and controls ."
10651126 resetAction = {
10661127 colors . accentColor !== DEFAULT_THEME_COLORS . accentColor ||
1067- colors . neutralColor !== DEFAULT_THEME_COLORS . neutralColor ? (
1128+ colors . neutralColor !== DEFAULT_THEME_COLORS . neutralColor ||
1129+ colors . contrast !== DEFAULT_THEME_COLORS . contrast ? (
10681130 < SettingResetButton
10691131 label = "theme colors"
10701132 onClick = { ( ) => setThemeColors ( DEFAULT_THEME_COLORS ) }
@@ -1082,14 +1144,41 @@ export function AppearanceSettingsPanel() {
10821144 }
10831145 />
10841146 < ThemeColorControl
1085- label = "Neutral color "
1147+ label = "Surface tint "
10861148 value = { colors . neutralColor }
10871149 swatches = { THEME_NEUTRAL_SWATCHES }
10881150 onChange = { ( neutralColor ) =>
10891151 setThemeColors ( { ...colors , neutralColor } satisfies ThemeColors )
10901152 }
10911153 />
10921154 </ div >
1155+ < div className = "flex items-center gap-4 border-t border-border/70 py-4" >
1156+ < label htmlFor = "theme-contrast" className = "text-xs font-medium text-foreground" >
1157+ Interface contrast
1158+ </ label >
1159+ < input
1160+ id = "theme-contrast"
1161+ type = "range"
1162+ min = { 0 }
1163+ max = { 100 }
1164+ step = { 5 }
1165+ value = { colors . contrast }
1166+ style = { { accentColor : colors . accentColor } }
1167+ onChange = { ( event ) =>
1168+ setThemeColors ( {
1169+ ...colors ,
1170+ contrast : Number ( event . currentTarget . value ) ,
1171+ } satisfies ThemeColors )
1172+ }
1173+ className = "min-w-0 flex-1 cursor-pointer"
1174+ />
1175+ < output
1176+ htmlFor = "theme-contrast"
1177+ className = "w-8 text-right font-mono text-xs tabular-nums text-muted-foreground"
1178+ >
1179+ { colors . contrast }
1180+ </ output >
1181+ </ div >
10931182 </ SettingsRow >
10941183
10951184 < SettingsRow
0 commit comments