import { hsluv2hex } from '@thematic/color' ; import { Theme as ThemeImpl } from './Theme' ; import autumn from './themes/autumn.json' ; import defaultTheme from './themes/default.json' ; import metal from './themes/metal.json' ; import ocean from './themes/ocean.json' ; import { Theme , ThemeListing , ThemeConfig , ThemeSpec } from './types' ; const themes = { default : defaultTheme , autumn , ocean , metal , } ; /**
 * This is a list of the built-in themes.
 * These can be loaded using the loadById function.
 */ export const defaultThemes = Object . entries ( themes ) . map ( entry => { const [ key , value ] = entry ; const { accentHue , accentSaturation , accentLuminance } = value . params ; return { id : key , name : value . name , accent : hsluv2hex ( accentHue , accentSaturation , accentLuminance ) , } ; } ) ; param config export function load ( config ? ) { return new ThemeImpl ( themes [ 'default' ] , config ) ; } param config export function loadById ( id , config ? ) { return new ThemeImpl ( ( themes as any ) [ id ] , config ) ; } param spec param config export function loadFromSpec ( spec , config ? ) { return new ThemeImpl ( spec , config ) ; } param theme param updatedSpec params export function clone ( theme , updatedSpec ? , updatedConfig ? ) { return theme . clone ( updatedSpec ! , updatedConfig ) ; }