1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow
    
  8.  */
    
  9. 
    
  10. import {useContext, useMemo} from 'react';
    
  11. import {SettingsContext} from './Settings/SettingsContext';
    
  12. import {THEME_STYLES} from '../constants';
    
  13. 
    
  14. const useThemeStyles = (): any => {
    
  15.   const {theme, displayDensity, browserTheme} = useContext(SettingsContext);
    
  16. 
    
  17.   const style = useMemo(
    
  18.     () => ({
    
  19.       ...THEME_STYLES[displayDensity],
    
  20.       ...THEME_STYLES[theme === 'auto' ? browserTheme : theme],
    
  21.     }),
    
  22.     [theme, browserTheme, displayDensity],
    
  23.   );
    
  24. 
    
  25.   return style;
    
  26. };
    
  27. 
    
  28. export default useThemeStyles;