1616 * under the License.
1717 */
1818
19+ import { RecursivePartial } from '../models/utility-types' ;
1920import { Theme , ThemeConfig } from './types' ;
2021
2122const lightTheme : ThemeConfig = {
@@ -24,6 +25,10 @@ const lightTheme: ThemeConfig = {
2425 main : '#1a73e8' ,
2526 contrastText : '#ffffff' ,
2627 } ,
28+ secondary : {
29+ main : '#424242' ,
30+ contrastText : '#ffffff' ,
31+ } ,
2732 background : {
2833 surface : '#f5f5f5' ,
2934 disabled : '#f0f0f0' ,
@@ -58,6 +63,10 @@ const darkTheme: ThemeConfig = {
5863 main : '#1a73e8' ,
5964 contrastText : '#ffffff' ,
6065 } ,
66+ secondary : {
67+ main : '#424242' ,
68+ contrastText : '#ffffff' ,
69+ } ,
6170 background : {
6271 surface : '#121212' ,
6372 disabled : '#1f1f1f' ,
@@ -86,12 +95,14 @@ const darkTheme: ThemeConfig = {
8695 } ,
8796} ;
8897
89- const toCssVariables = ( theme : ThemeConfig ) : Record < string , string > => {
98+ const toCssVariables = ( theme : RecursivePartial < ThemeConfig > ) : Record < string , string > => {
9099 const cssVars : Record < string , string > = { } ;
91100
92101 // Colors
93102 cssVars [ '--asgardeo-color-primary-main' ] = theme . colors . primary . main ;
94103 cssVars [ '--asgardeo-color-primary-contrastText' ] = theme . colors . primary . contrastText ;
104+ cssVars [ '--asgardeo-color-secondary-main' ] = theme . colors . secondary . main ;
105+ cssVars [ '--asgardeo-color-secondary-contrastText' ] = theme . colors . secondary . contrastText ;
95106 cssVars [ '--asgardeo-color-background-surface' ] = theme . colors . background . surface ;
96107 cssVars [ '--asgardeo-color-background-disabled' ] = theme . colors . background . disabled ;
97108 cssVars [ '--asgardeo-color-background-body-main' ] = theme . colors . background . body . main ;
@@ -113,14 +124,18 @@ const toCssVariables = (theme: ThemeConfig): Record<string, string> => {
113124 return cssVars ;
114125} ;
115126
116- const createTheme = ( config : Partial < ThemeConfig > = { } , isDark = false ) : Theme => {
127+ const createTheme = ( config : RecursivePartial < ThemeConfig > = { } , isDark = false ) : Theme => {
117128 const baseTheme = isDark ? darkTheme : lightTheme ;
118129 const mergedConfig = {
119130 ...baseTheme ,
120131 ...config ,
121132 colors : {
122133 ...baseTheme . colors ,
123134 ...config . colors ,
135+ secondary : {
136+ ...baseTheme . colors . secondary ,
137+ ...( config . colors ?. secondary || { } ) ,
138+ } ,
124139 } ,
125140 spacing : {
126141 ...baseTheme . spacing ,
@@ -130,7 +145,7 @@ const createTheme = (config: Partial<ThemeConfig> = {}, isDark = false): Theme =
130145 ...baseTheme . borderRadius ,
131146 ...config . borderRadius ,
132147 } ,
133- } ;
148+ } as ThemeConfig ;
134149
135150 return {
136151 ...mergedConfig ,
0 commit comments