import { LayoutConfigThemeOptions } from 'types/theme' export const getTheme = (themeConfig: LayoutConfigThemeOptions, layoutId?: string): any => { if (!layoutId) return themeConfig.default const matchingTheme = themeConfig.layoutThemes.filter(theme => theme.layoutId === layoutId) return (matchingTheme.length > 0) ? matchingTheme[0].theme : ( themeConfig.default ? themeConfig.default : ( console.error('No default theme supplied for this component.') ) ) }