Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new colors and define green theme #292

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";
steff456 marked this conversation as resolved.
Show resolved Hide resolved

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
48 changes: 48 additions & 0 deletions src/colors.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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"
};

export const red = "#D72D47";

export const orange = "#F66A0A";

export const blue = "#276BE9";

export const white = "#FFFFFF";

export const black = "#000000";
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";
77 changes: 73 additions & 4 deletions src/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,89 @@
import { createTheme, ThemeProvider } from "@mui/material";
import React from "react";

export const theme = createTheme({
import { green, purple, gray, white, red, orange, blue, black } from "./colors";

export const grayscaleTheme = createTheme({
typography: {
fontFamily: '"Inter", sans-serif'
},
palette: {
primary: {
main: "#C4C4C4"
main: "#C4C4C4",
contrastText: white
},
secondary: {
main: "#7E7E7E"
main: "#7E7E7E",
contrastText: white
Comment on lines +15 to +20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smeragoel will have to confirm here the exact colours

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a blocker for this PR or can we add the colors for the grayscale theme in a follow up PR?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope we can merge this and implement this later

}
}
});

const baseTheme = createTheme({
typography: {
fontFamily: '"Inter", sans-serif'
},
palette: {
primary: {
light: green[300],
main: green[400],
dark: green[700],
steff456 marked this conversation as resolved.
Show resolved Hide resolved
contrastText: white
},
secondary: {
light: gray[300],
main: gray[400],
dark: gray[700],
contrastText: white
},
warning: {
steff456 marked this conversation as resolved.
Show resolved Hide resolved
main: orange,
contrastText: white
},
error: {
main: red,
contrastText: white
},
info: {
main: blue,
contrastText: white
},
success: {
main: green[500],
contrastText: white
},
mode: "light"
steff456 marked this conversation as resolved.
Show resolved Hide resolved
}
});

export const greenTheme = createTheme(baseTheme, {
palette: {
accent: baseTheme.palette.augmentColor({
color: {
light: purple[300],
main: purple[400],
dark: purple[700],
steff456 marked this conversation as resolved.
Show resolved Hide resolved
contrastText: white
},
name: "accent"
}),
white: baseTheme.palette.augmentColor({
color: {
main: white,
contrastText: black
},
name: "white"
}),
black: baseTheme.palette.augmentColor({
color: {
main: black,
contrastText: white
},
name: "black"
})
}
});

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