import React from 'react' ; import { useDefaultThemeName , useThemeName } from '../hooks/useTheme' ; import { Theme } from './Theme' ; type StringRecord = { [ key ] : string ; } ; let inversions = { light : 'dark' , dark : 'light' , } ; export function setThemeInversions ( next ) { inversions = next ; } export const ThemeInverse = ( props ) => { const themeName = useThemeName ( ) ; const defaultTheme = useDefaultThemeName ( ) ; const name = inversions [ themeName ] || inversions [ defaultTheme ] || null ; return < Theme name = { name } > { props . children } < /Theme>; } ;