mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
theme: add support for setting default theme via global variable
This commit is contained in:
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {
|
||||
SchemeColors,
|
||||
SchemeColorsAsCSSVariables
|
||||
SchemeColorsAsCSSVariables,
|
||||
ThemeDefinition
|
||||
} from "./theme-engine/types.js";
|
||||
|
||||
export * from "./theme/index.js";
|
||||
@@ -26,6 +27,11 @@ export * from "./theme-engine/index.js";
|
||||
export * from "./theme-engine/types.js";
|
||||
export * from "./emotion/index.js";
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-var
|
||||
var DEFAULT_THEME: ThemeDefinition | undefined;
|
||||
}
|
||||
|
||||
declare module "csstype" {
|
||||
interface Properties {
|
||||
backgroundColor?:
|
||||
|
||||
@@ -43,7 +43,7 @@ type ThemeEngineState = {
|
||||
setTheme: (theme: ThemeDefinition) => void;
|
||||
};
|
||||
const useThemeEngineStore = create<ThemeEngineState>((set) => ({
|
||||
theme: ThemeLight,
|
||||
theme: globalThis.DEFAULT_THEME || ThemeLight,
|
||||
setTheme: (theme) => set({ theme })
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user