Skip to content

Commit

Permalink
Add new colors and define green theme
Browse files Browse the repository at this point in the history
  • Loading branch information
steff456 committed Sep 15, 2023
1 parent 942347c commit 12a94c7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
prefGlobal
} from "./preferences";
import { store } from "./store";
import { theme } from "./theme";
import { greenTheme, grayscaleTheme } from "./theme";

import "../style/index.css";

Expand Down Expand Up @@ -78,7 +78,13 @@ export class App<
render(): React.ReactNode {
return (
<PrefContext.Provider value={this.state.pref}>
<ThemeProvider theme={theme}>
<ThemeProvider
theme={
this.state.pref.styleType === "grayscale"
? grayscaleTheme
: greenTheme
}
>
<Provider store={store}>
<AppRouter />
</Provider>
Expand Down
38 changes: 38 additions & 0 deletions src/colors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export const green = {
50: "#D6EEDC",
100: "#ADDCBA",
200: "#85CB97",
300: "#5CB975",
400: "#36AB55",
500: "#298642",
600: "#206532",
700: "#144321",
800: "#0A2210",
900: "#051108"
};

export const gray = {
50: "#F7F8F8",
100: "#E1E3E4",
200: "#C3C7CB",
300: "#A6ACB2",
400: "#90969C",
500: "#5B5F63",
600: "#44474A",
700: "#3C3C3B",
800: "#242628",
900: "#1A1C1D"
};

export const purple = {
50: "#E7E0F0",
100: "#D0C0E5",
200: "#B9A1DA",
300: "#A78BD0",
400: "#8966C2",
500: "#6643A8",
600: "#55309D",
700: "#3B216E",
800: "#2F1957",
900: "#231240"
};
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./App";
export { IPreferences } from "./preferences";
export { store } from "./store";
export { theme, themeDecorator } from "./theme";
export { grayscaleTheme, greenTheme, themeDecorator } from "./theme";
export * from "./colors";
30 changes: 28 additions & 2 deletions src/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { createTheme, ThemeProvider } from "@mui/material";
import React from "react";

export const theme = createTheme({
import { green, purple, gray } from "./colors";

export const grayscaleTheme = createTheme({
typography: {
fontFamily: '"Inter", sans-serif'
},
Expand All @@ -15,6 +17,30 @@ export const theme = createTheme({
}
});

export const greenTheme = createTheme({
typography: {
fontFamily: '"Inter", sans-serif'
},
palette: {
primary: {
light: green[100],
main: green[400],
dark: green[600]
},
secondary: {
light: gray[100],
main: gray[400],
dark: gray[600]
},
warning: {
light: purple[100],
main: purple[400],
dark: purple[600]
},
mode: "light"
}
});

export const themeDecorator = (func: any) => (
<ThemeProvider theme={theme}>{func()}</ThemeProvider>
<ThemeProvider theme={greenTheme}>{func()}</ThemeProvider>
);

0 comments on commit 12a94c7

Please sign in to comment.