@@ -4,7 +4,7 @@ import { defineMessages, useVIntl } from '@vintl/vintl'
44
55const { formatMessage } = useVIntl ()
66
7- defineProps <{
7+ const { updateColorTheme, currentTheme, themeOptions, systemThemeColor } = defineProps <{
88 updateColorTheme: (theme : T ) => void
99 currentTheme: T
1010 themeOptions: readonly T []
@@ -53,6 +53,11 @@ const colorTheme = defineMessages({
5353function asString(theme : T ): string {
5454 return theme
5555}
56+
57+ function getPreviewClass(option : T ): string {
58+ const base = option === ' system' ? systemThemeColor : option
59+ return base .endsWith (' -mode' ) ? base : ` ${base }-mode `
60+ }
5661 </script >
5762
5863<template >
@@ -64,7 +69,7 @@ function asString(theme: T): string {
6469 :class =" { selected: currentTheme === option }"
6570 @click =" () => updateColorTheme(option)"
6671 >
67- <div class =" preview" :class =" `${ option === 'system' ? systemThemeColor : option}-mode` " >
72+ <div class =" preview" :class =" getPreviewClass( option) " >
6873 <div class =" example-card card card" >
6974 <div class =" example-icon" ></div >
7075 <div class =" example-text-1" ></div >
@@ -96,6 +101,24 @@ function asString(theme: T): string {
96101 grid-template-columns : repeat (auto-fit , minmax (10rem , 1fr ));
97102 gap : var (--gap-lg );
98103
104+ .preview {
105+ & .light-mode {
106+ @extend .light-mode ;
107+ }
108+
109+ & .dark-mode {
110+ @extend .dark-mode ;
111+ }
112+
113+ & .oled-mode {
114+ @extend .oled-mode ;
115+ }
116+
117+ & .retro-mode {
118+ @extend .retro-mode ;
119+ }
120+ }
121+
99122 .preview .example-card {
100123 margin : 0 ;
101124 padding : 1rem ;
0 commit comments