chore: clean up contrasting colours code

This commit is contained in:
Paul
2021-12-24 14:13:10 +00:00
parent c138f58b12
commit ee5c102f16
9 changed files with 141 additions and 34 deletions

View File

@@ -279,7 +279,6 @@ export const PRESETS: Record<string, Theme> = {
},
};
const keys = Object.keys(PRESETS.dark);
const GlobalTheme = createGlobalStyle<{ theme: Theme }>`
:root {
${(props) => generateVariables(props.theme)}
@@ -288,7 +287,6 @@ const GlobalTheme = createGlobalStyle<{ theme: Theme }>`
export const generateVariables = (theme: Theme) => {
return (Object.keys(theme) as Variables[]).map((key) => {
if (!keys.includes(key)) return;
return `--${key}: ${theme[key]};`;
});
};
@@ -326,7 +324,7 @@ export default observer(() => {
return () => window.removeEventListener("resize", resize);
}, [root]);
const variables = theme.getVariables();
const variables = theme.computeVariables();
return (
<>
<Helmet>