aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/components/Themer.tsx
diff options
context:
space:
mode:
authorSascha <GlancingMind@outlook.com>2021-03-06 17:25:23 +0100
committerSascha <GlancingMind@outlook.com>2021-03-06 17:34:45 +0100
commitc2c5c40e752663e238bdd29c54d3a5634ba9615c (patch)
tree9ea5d68e9ae824ade0b2881103447199f8b0c232 /webui/src/components/Themer.tsx
parent188ee0567cf374cb0bb3deb0bb3dcb78ffccc140 (diff)
downloadgit-bug-c2c5c40e752663e238bdd29c54d3a5634ba9615c.tar.gz
Change color of ModeIcon
Will use contrastText which should always make the icon visible, but use fade to dimme the contrast down.
Diffstat (limited to 'webui/src/components/Themer.tsx')
-rw-r--r--webui/src/components/Themer.tsx22
1 files changed, 15 insertions, 7 deletions
diff --git a/webui/src/components/Themer.tsx b/webui/src/components/Themer.tsx
index badd543b..b4877974 100644
--- a/webui/src/components/Themer.tsx
+++ b/webui/src/components/Themer.tsx
@@ -1,29 +1,37 @@
import React, { createContext, useContext, useState } from 'react';
-import { ThemeProvider } from '@material-ui/core';
+import { fade, ThemeProvider } from '@material-ui/core';
import IconButton from '@material-ui/core/IconButton/IconButton';
import Tooltip from '@material-ui/core/Tooltip/Tooltip';
import { Theme } from '@material-ui/core/styles';
import { NightsStayRounded, WbSunnyRounded } from '@material-ui/icons';
+import { makeStyles } from '@material-ui/styles';
const ThemeContext = createContext({
toggleMode: () => {},
mode: '',
});
+const useStyles = makeStyles((theme: Theme) => ({
+ iconButton: {
+ color: fade(theme.palette.primary.contrastText, 0.5),
+ },
+}));
+
const LightSwitch = () => {
const { mode, toggleMode } = useContext(ThemeContext);
const nextMode = mode === 'light' ? 'dark' : 'light';
const description = `Switch to ${nextMode} theme`;
+ const classes = useStyles();
return (
<Tooltip title={description}>
- <IconButton onClick={toggleMode} aria-label={description}>
- {mode === 'light' ? (
- <WbSunnyRounded color="secondary" />
- ) : (
- <NightsStayRounded color="secondary" />
- )}
+ <IconButton
+ onClick={toggleMode}
+ aria-label={description}
+ className={classes.iconButton}
+ >
+ {mode === 'light' ? <WbSunnyRounded /> : <NightsStayRounded />}
</IconButton>
</Tooltip>
);