Skip to content

Commit

Permalink
ENH - Redefine new themes and colours (#292)
Browse files Browse the repository at this point in the history
* Add new colors and define green theme

* Add new colors for roles and fix the shade used previously

* update main shade of color

* Change name to condaStoreTheme, define more colors and refactor baseTheme
  • Loading branch information
steff456 authored Sep 25, 2023
1 parent 942347c commit 9ca3ef4
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 8 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 { condaStoreTheme, 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
: condaStoreTheme
}
>
<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, condaStoreTheme, themeDecorator } from "./theme";
export * from "./colors";
109 changes: 104 additions & 5 deletions src/theme.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,119 @@
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";

const baseTheme = createTheme({
typography: {
fontFamily: '"Inter", sans-serif'
},
}
});

export const grayscaleTheme = createTheme(baseTheme, {
palette: {
primary: {
main: "#C4C4C4"
main: "#C4C4C4",
contrastText: white
},
secondary: {
main: "#7E7E7E"
main: "#7E7E7E",
contrastText: white
}
}
});

export const condaStoreTheme = createTheme(baseTheme, {
palette: {
accent: baseTheme.palette.augmentColor({
color: {
light: purple[300],
main: purple[500],
dark: purple[700],
contrastText: white,
50: purple[50],
100: purple[100],
200: purple[200],
300: purple[300],
400: purple[400],
500: purple[500],
600: purple[600],
700: purple[700],
800: purple[800],
900: purple[900]
},
name: "accent"
}),
primary: baseTheme.palette.augmentColor({
color: {
light: green[300],
main: green[500],
dark: green[700],
contrastText: white,
50: green[50],
100: green[100],
200: green[200],
300: green[300],
400: green[400],
500: green[500],
600: green[600],
700: green[700],
800: green[800],
900: green[900]
},
name: "primary"
}),
secondary: baseTheme.palette.augmentColor({
color: {
light: gray[300],
main: gray[500],
dark: gray[700],
contrastText: white,
50: gray[50],
100: gray[100],
200: gray[200],
300: gray[300],
400: gray[400],
500: gray[500],
600: gray[600],
700: gray[700],
800: gray[800],
900: gray[900]
},
name: "secondary"
}),
warning: {
main: orange,
contrastText: white
},
error: {
main: red,
contrastText: white
},
info: {
main: blue,
contrastText: white
},
success: {
main: green[500],
contrastText: white
},
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={condaStoreTheme}>{func()}</ThemeProvider>
);

0 comments on commit 9ca3ef4

Please sign in to comment.