@@ -100,21 +100,6 @@ const contrastThreshold = 3;
100
100
const white = "#ffffff" as const ;
101
101
const black = "#000000" as const ;
102
102
103
- const text = {
104
- light : {
105
- primary : white ,
106
- secondary : _opaquify ( changeColorHsla ( white , { alpha : 0.64 } ) , "#121212" ) ,
107
- hint : _opaquify ( changeColorHsla ( white , { alpha : 0.32 } ) , "#121212" ) ,
108
- disabled : _opaquify ( changeColorHsla ( white , { alpha : 0.24 } ) , "#121212" )
109
- } ,
110
- dark : {
111
- primary : _opaquify ( changeColorHsla ( black , { alpha : 0.87 } ) , "#ffffff" ) ,
112
- secondary : _opaquify ( changeColorHsla ( black , { alpha : 0.56 } ) , "#ffffff" ) ,
113
- hint : _opaquify ( changeColorHsla ( black , { alpha : 0.32 } ) , "#ffffff" ) ,
114
- disabled : _opaquify ( changeColorHsla ( black , { alpha : 0.24 } ) , "#ffffff" )
115
- }
116
- } ;
117
-
118
103
const divider = {
119
104
dark : "rgba(0, 0, 0, 0.12)" ,
120
105
light : "rgba(255, 255, 255, 0.16)"
@@ -125,6 +110,42 @@ const background = {
125
110
dark : { origin : "#121212" , accents : { 1 : "#292929" , 2 : "#1f1f1f" } }
126
111
} ;
127
112
113
+ const text = {
114
+ light : {
115
+ primary : white ,
116
+ secondary : _opaquify (
117
+ changeColorHsla ( white , { alpha : 0.64 } ) ,
118
+ background . dark . origin
119
+ ) ,
120
+ hint : _opaquify (
121
+ changeColorHsla ( white , { alpha : 0.32 } ) ,
122
+ background . dark . origin
123
+ ) ,
124
+ disabled : _opaquify (
125
+ changeColorHsla ( white , { alpha : 0.24 } ) ,
126
+ background . dark . origin
127
+ )
128
+ } ,
129
+ dark : {
130
+ primary : _opaquify (
131
+ changeColorHsla ( black , { alpha : 0.87 } ) ,
132
+ background . light . origin
133
+ ) ,
134
+ secondary : _opaquify (
135
+ changeColorHsla ( black , { alpha : 0.56 } ) ,
136
+ background . light . origin
137
+ ) ,
138
+ hint : _opaquify (
139
+ changeColorHsla ( black , { alpha : 0.32 } ) ,
140
+ background . light . origin
141
+ ) ,
142
+ disabled : _opaquify (
143
+ changeColorHsla ( black , { alpha : 0.24 } ) ,
144
+ background . light . origin
145
+ )
146
+ }
147
+ } ;
148
+
128
149
const defaultSystemColors = {
129
150
primary : {
130
151
light : pink [ 500 ] ,
@@ -363,10 +384,10 @@ const createColors = (colorsInput?: ColorsInput): Colors => {
363
384
364
385
const getContrastColorOf = ( background : ColorInputType ) => {
365
386
const contrastForeground =
366
- calculateContrastRatio ( background , text . dark . primary ) >=
387
+ calculateContrastRatio ( background , text . light . primary ) >=
367
388
contrastThresholdInput
368
- ? text . dark . primary
369
- : text . light . primary ;
389
+ ? text . light . primary
390
+ : text . dark . primary ;
370
391
371
392
if ( process . env . NODE_ENV !== "production" ) {
372
393
const contrast = calculateContrastRatio ( background , contrastForeground ) ;
0 commit comments