1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 14:34:19 +00:00
pds-2021-g2-nest/nest_frontend/contexts/ContextTheme.js

19 lines
626 B
JavaScript

import { createContext } from "react"
/**
* A context containing an object with the following elements:
* - `theme` - A string containing the name of the current theme.
* - `setTheme` - A function that allows changing the `theme`.
*
* If trying to access the context from outside a provider, the theme will be `ThemeDark`, and the function will display
* an error in the console.
*
* @type {React.Context}
*/
const ContextTheme = createContext({
isSet: false,
theme: "ThemeDark",
setTheme: () => console.error("Trying to setTheme while outside a ContextTheme.Provider!"),
})
export default ContextTheme