@@ -5,17 +5,15 @@ import ColorUtils from '@/utils/color-utils';
5
5
export default function setTheme ( baseTheme , theme = { } ) {
6
6
let newTheme = { } ;
7
7
const primaryColor = theme . primaryColor ? theme . primaryColor : '#FF791A' ;
8
- const primaryColorInvert = ColorUtils . color . invert ( primaryColor ) ;
9
-
10
8
if ( baseTheme === 'dark' ) {
11
9
const bg1 = theme . bg1 ? theme . bg1 : '#333' ;
12
10
const fg1 = theme . fg1 ? theme . fg1 : '#bbb' ;
13
11
14
12
const bg2 = theme . bg2 ? theme . bg2 : ColorUtils . color . brightness ( bg1 , 5 ) ; // or #383838;
15
- const bg3 = theme . bg3 ? theme . bg3 : ColorUtils . color . brightness ( bg1 , 10 ) ; // or #444;
16
- const fg2 = theme . fg2 ? theme . fg2 : ColorUtils . color . brightness ( fg1 , - 5 ) ; // or #ababab
17
- const fg3 = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , - 10 ) ; // or #aaa
18
- const lightFg = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , - 30 ) ; // or #777
13
+ const bg3 = theme . bg3 ? theme . bg3 : ColorUtils . color . brightness ( bg1 , 15 ) ; // or #444;
14
+ const fg2 = theme . fg2 ? theme . fg2 : ColorUtils . color . brightness ( fg1 , - 15 ) ; // or #ababab
15
+ const fg3 = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , - 20 ) ; // or #aaa
16
+ const lightFg = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , - 80 ) ; // or #777
19
17
const headerColor = theme . headerColor ? theme . headerColor : ColorUtils . color . brightness ( bg1 , 10 ) ;
20
18
21
19
const navBgColor = theme . navBgColor ? theme . navBgColor : ColorUtils . color . brightness ( bg1 , 10 ) ;
@@ -32,6 +30,7 @@ export default function setTheme(baseTheme, theme = {}) {
32
30
fg2,
33
31
fg3,
34
32
lightFg,
33
+ primaryColor,
35
34
36
35
navBgColor,
37
36
navTextColor,
@@ -78,11 +77,11 @@ export default function setTheme(baseTheme, theme = {}) {
78
77
const fg1 = theme . fg1 ? theme . fg1 : '#444' ;
79
78
80
79
const bg2 = theme . bg2 ? theme . bg2 : ColorUtils . color . brightness ( bg1 , - 5 ) ; // or '#fafafa'
81
- const bg3 = theme . bg3 ? theme . bg3 : ColorUtils . color . brightness ( bg2 , - 10 ) ; // or '#f6f6f6'
80
+ const bg3 = theme . bg3 ? theme . bg3 : ColorUtils . color . brightness ( bg1 , - 15 ) ; // or '#f6f6f6'
82
81
83
- const fg2 = theme . fg2 ? theme . fg2 : ColorUtils . color . brightness ( fg1 , 5 ) ; // or '#555'
84
- const fg3 = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , 10 ) ; // or #666
85
- const lightFg = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , 30 ) ; // or #999
82
+ const fg2 = theme . fg2 ? theme . fg2 : ColorUtils . color . brightness ( fg1 , 17 ) ; // or '#555'
83
+ const fg3 = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , 30 ) ; // or #666
84
+ const lightFg = theme . fg3 ? theme . fg3 : ColorUtils . color . brightness ( fg1 , 80 ) ; // or #999
86
85
const headerColor = theme . headerColor ? theme . headerColor : ColorUtils . color . brightness ( bg1 , - 180 ) ;
87
86
88
87
const navBgColor = theme . navBgColor ? theme . navBgColor : ColorUtils . color . brightness ( bg1 , - 10 ) ;
@@ -99,6 +98,7 @@ export default function setTheme(baseTheme, theme = {}) {
99
98
fg2,
100
99
fg3,
101
100
lightFg,
101
+ primaryColor,
102
102
103
103
navBgColor,
104
104
navTextColor,
@@ -189,9 +189,8 @@ export default function setTheme(baseTheme, theme = {}) {
189
189
- - nav- accent- color : ${ newTheme . navAccentColor } ;
190
190
191
191
/* Primary Colors */
192
- - - primary- color : ${ primaryColor } ;
193
- - - primary- color - invert: ${ primaryColorInvert } ;
194
-
192
+ - - primary- color : ${ newTheme . primaryColor } ;
193
+ - - primary- color - invert: ${ ColorUtils . color . invert ( newTheme . primaryColor ) } ;
195
194
}
196
195
</ style > ` ;
197
196
}
0 commit comments