interface Window { __themeState__ : any ; } declare var window ; export class ThemeColorHelper { param value public static GetThemeColor ( value ) { try { if ( value . indexOf ( 'theme:' ) > 0 ) { const themeParts = value . replace ( '[' , '' ) . replace ( ']' , '' ) . replace ( '"' , '' ) . split ( ',' ) ; let defaultValue = undefined ; let themeValue = undefined ; themeParts . forEach ( themePart => { if ( themePart . indexOf ( 'theme:' ) >= 0 ) { themeValue = themePart . replace ( 'theme:' , '' ) ; } else if ( themePart . indexOf ( 'default:' ) >= 0 ) { defaultValue = themePart . replace ( 'default:' , '' ) . replace ( '"' , '' ) . trim ( ) ; } } ) ; if ( themeValue !== undefined ) { try { const themeStateVariable = window . __themeState__ ; if ( themeStateVariable === undefined ) { return defaultValue ; } const themeState = themeStateVariable . theme ; if ( themeState === undefined ) { return defaultValue ; } for ( const varName in themeState ) { if ( ! themeState . hasOwnProperty ( varName ) ) { continue ; } if ( varName === themeValue ) { return themeState [ varName ] . replace ( '"' , '' ) . trim ( ) ; } } } catch ( error ) { } return defaultValue ; } } } catch ( error ) { } return value ; } }