11import { transparentize } from 'polished'
2+ import { CSSLength } from '../types/length'
3+ import { cssDiv } from '../utils/css'
4+ import { cssLength } from '../utils/length'
25
36const defaultPalette = {
47 white : '#ffffff' ,
@@ -50,23 +53,20 @@ const defaultPalette = {
5053 } ,
5154}
5255
56+ export interface SolvedTextColor {
57+ main : string
58+ inverted : string
59+ light : string
60+ dark : string
61+ }
62+
5363export interface SolvedTheme {
5464 name : string
5565 color : {
5666 solvedAc : string
5767 text : {
58- primary : {
59- main : string
60- inverted : string
61- light : string
62- dark : string
63- }
64- secondary : {
65- main : string
66- inverted : string
67- light : string
68- dark : string
69- }
68+ primary : SolvedTextColor
69+ secondary : SolvedTextColor
7070 }
7171 background : {
7272 page : string
@@ -95,7 +95,7 @@ export interface SolvedTheme {
9595 }
9696 styles : {
9797 border : ( color ?: string ) => string
98- shadow : ( color ?: string , length ?: number ) => string
98+ shadow : ( color ?: string , length ?: CSSLength ) => string
9999 }
100100}
101101
@@ -139,10 +139,11 @@ const Light: SolvedTheme = {
139139 styles : {
140140 border : ( color ?: string ) =>
141141 `1px solid ${ color || defaultPalette . gray [ 200 ] } ` ,
142- shadow : ( color ?: string , length ?: number ) =>
143- `${ transparentize ( 0.6 , color || defaultPalette . gray [ 200 ] ) } 0px ${
144- ( length || 8 ) / 2
145- } px ${ length || 8 } px`,
142+ shadow : ( color ?: string , length ?: CSSLength ) =>
143+ `${ transparentize (
144+ 0.6 ,
145+ color || defaultPalette . gray [ 200 ]
146+ ) } 0px ${ cssLength ( cssDiv ( length || 8 , 2 ) ) } ${ cssLength ( length || 8 ) } `,
146147 } ,
147148}
148149
@@ -177,10 +178,11 @@ const Dark: SolvedTheme = {
177178 styles : {
178179 border : ( color ?: string ) =>
179180 `1px solid ${ ( color || defaultPalette . gray [ 700 ] ) . toString ( ) } ` ,
180- shadow : ( color ?: string , length ?: number ) =>
181- `${ transparentize ( 0.6 , color || defaultPalette . gray [ 200 ] ) } 0px ${
182- ( length || 8 ) / 2
183- } px ${ length || 8 } px`,
181+ shadow : ( color ?: string , length ?: CSSLength ) =>
182+ `${ transparentize (
183+ 0.6 ,
184+ color || defaultPalette . gray [ 200 ]
185+ ) } 0px ${ cssLength ( cssDiv ( length || 8 , 2 ) ) } ${ cssLength ( length || 8 ) } `,
184186 } ,
185187}
186188
@@ -200,10 +202,11 @@ const Black: SolvedTheme = {
200202 styles : {
201203 border : ( color ?: string ) =>
202204 `1px solid ${ ( color || defaultPalette . gray [ 900 ] ) . toString ( ) } ` ,
203- shadow : ( color ?: string , length ?: number ) =>
204- `${ transparentize ( 0.6 , color || defaultPalette . gray [ 200 ] ) } 0px ${
205- ( length || 8 ) / 2
206- } px ${ length || 8 } px`,
205+ shadow : ( color ?: string , length ?: CSSLength ) =>
206+ `${ transparentize (
207+ 0.6 ,
208+ color || defaultPalette . gray [ 200 ]
209+ ) } 0px ${ cssLength ( cssDiv ( length || 8 , 2 ) ) } ${ cssLength ( length || 8 ) } `,
207210 } ,
208211}
209212
0 commit comments