import themeVariables from '@vscodethemes/theme-variables' ; import { Colors , ThemeType } from '@vscodethemes/types' ; const unwrap = ( fn , ... args ) => { if ( typeof fn === 'function' ) { return fn ( ... args ) ; } return fn ; } ; export default function withDefaultColors ( type , colors ) { const withDefaults = { ... colors } ; Object . keys ( themeVariables ) . forEach ( ( key ) => { const colorVar = themeVariables [ key ] ; if ( ! colors [ key ] ) { withDefaults [ key ] = unwrap ( colorVar . defaults [ type ] , withDefaults ) ; } } ) ; return withDefaults ; }