Better dark mode colors

This commit is contained in:
Ben Grant 2021-06-05 23:40:23 +10:00
parent dada28d723
commit 2c43a8e0d2
12 changed files with 51 additions and 36 deletions

View file

@ -97,17 +97,17 @@ const App = () => {
borderRadius: 100, borderRadius: 100,
border: `4px solid ${theme.primaryBackground}`, border: `4px solid ${theme.primaryBackground}`,
width: 12, width: 12,
background: `${theme.primaryLight}AA`, background: `${theme.mode === 'light' ? theme.primaryLight : theme.primaryDark}AA`,
}, },
'*::-webkit-scrollbar-thumb:hover': { '*::-webkit-scrollbar-thumb:hover': {
background: `${theme.primaryLight}CC`, background: `${theme.mode === 'light' ? theme.primaryLight : theme.primaryDark}CC`,
}, },
'*::-webkit-scrollbar-thumb:active': { '*::-webkit-scrollbar-thumb:active': {
background: `${theme.primaryLight}`, background: `${theme.mode === 'light' ? theme.primaryLight : theme.primaryDark}`,
}, },
})} })}
/> />
<Suspense fallback={<Loading />}> <Suspense fallback={<Loading />}>
<Settings /> <Settings />
</Suspense> </Suspense>

View file

@ -12,10 +12,9 @@ export const Pressable = styled.button`
font: inherit; font: inherit;
box-sizing: border-box; box-sizing: border-box;
background: ${props => props.primaryColor || props.theme.primary}; background: ${props => props.primaryColor || props.theme.primary};
color: #FFF; color: ${props => props.primaryColor ? '#FFF' : props.theme.background};
font-weight: 600; font-weight: 600;
text-shadow: 0 -1px .5px ${props => props.secondaryColor || props.theme.primaryDark}; transition: transform 150ms cubic-bezier(0, 0, 0.58, 1);
transition: transform 150ms cubic-bezier(0, 0, 0.58, 1), background 150ms cubic-bezier(0, 0, 0.58, 1);
border-radius: 3px; border-radius: 3px;
padding: ${props => props.small ? '.4em 1.3em' : '.6em 1.5em'}; padding: ${props => props.small ? '.4em 1.3em' : '.6em 1.5em'};
transform-style: preserve-3d; transform-style: preserve-3d;
@ -55,7 +54,6 @@ export const Pressable = styled.button`
} }
${props => props.isLoading && ` ${props => props.isLoading && `
text-shadow: none;
color: transparent; color: transparent;
cursor: wait; cursor: wait;
@ -103,4 +101,18 @@ export const Pressable = styled.button`
} }
} }
`} `}
${props => props.alt && `
background: transparent;
border: 1px solid ${props.primaryColor || props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
color: ${props.primaryColor || props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
margin-bottom: 0;
&::before {
content: none;
}
&:hover, &:active {
transform: none;
}
`}
`; `;

View file

@ -78,7 +78,7 @@ export const Date = styled.button`
} }
background-color: ${props => props.theme.primaryBackground}; background-color: ${props => props.theme.primaryBackground};
border: 1px solid ${props => props.theme.primaryLight}; border: 1px solid ${props => props.theme.primary};
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -87,20 +87,18 @@ export const Date = styled.button`
touch-action: none; touch-action: none;
${props => props.otherMonth && ` ${props => props.otherMonth && `
color: ${props.theme.primaryLight}; color: ${props.theme.mode === 'light' ? props.theme.primaryLight : props.theme.primaryDark};
`} `}
${props => props.isToday && ` ${props => props.isToday && `
font-weight: 900; font-weight: 900;
color: ${props.theme.primaryDark}; color: ${props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
`} `}
${props => (props.selected || (props.mode === 'add' && props.selecting)) && ` ${props => (props.selected || (props.mode === 'add' && props.selecting)) && `
color: ${props.otherMonth ? 'rgba(255,255,255,.5)' : '#FFF'}; color: ${props.otherMonth ? 'rgba(255,255,255,.5)' : '#FFF'};
background-color: ${props.theme.primary}; background-color: ${props.theme.primary};
border-color: ${props.theme.primary};
`} `}
${props => props.mode === 'remove' && props.selecting && ` ${props => props.mode === 'remove' && props.selecting && `
background-color: ${props.theme.primaryBackground}; background-color: ${props.theme.primaryBackground};
border: 1px solid ${props.theme.primaryLight};
color: ${props.isToday ? props.theme.primaryDark : (props.otherMonth ? props.theme.primaryLight : 'inherit')}; color: ${props.isToday ? props.theme.primaryDark : (props.otherMonth ? props.theme.primaryLight : 'inherit')};
`} `}
`; `;

View file

@ -118,6 +118,7 @@ const Donate = () => {
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"
ref={buttonRef} ref={buttonRef}
style={{ whiteSpace: 'nowrap' }}
>{t('donate.button')}</Button> >{t('donate.button')}</Button>
<Options <Options

View file

@ -4,7 +4,7 @@ export const Wrapper = styled.div`
border-radius: 3px; border-radius: 3px;
background-color: ${props => props.theme.error}; background-color: ${props => props.theme.error};
color: #FFFFFF; color: #FFFFFF;
padding: 12px 16px; padding: 0 16px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
@ -13,16 +13,17 @@ export const Wrapper = styled.div`
max-height: 0; max-height: 0;
margin: 0; margin: 0;
visibility: hidden; visibility: hidden;
transition: margin .2s, max-height .2s; transition: margin .2s, padding .2s, max-height .2s;
${props => props.open && ` ${props => props.open && `
opacity: 1; opacity: 1;
visibility: visible; visibility: visible;
margin: 20px 0; margin: 20px 0;
padding: 12px 16px;
max-height: 60px; max-height: 60px;
transition: opacity .15s .2s, max-height .2s, margin .2s, visibility .2s; transition: opacity .15s .2s, max-height .2s, margin .2s, padding .2s, visibility .2s;
`} `}
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
transition: none; transition: none;
} }

View file

@ -12,7 +12,7 @@ export const Recent = styled.a`
& .name { & .name {
font-weight: 700; font-weight: 700;
font-size: 1.1em; font-size: 1.1em;
color: ${props => props.theme.primaryDark}; color: ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
flex: 1; flex: 1;
display: block; display: block;
} }

View file

@ -38,8 +38,8 @@ export const StyledSelect = styled.select`
background: ${props => props.theme.primaryBackground}; background: ${props => props.theme.primaryBackground};
color: inherit; color: inherit;
padding: 10px 14px; padding: 10px 14px;
border: 1px solid ${props => props.theme.primaryLight}; border: 1px solid ${props => props.theme.primary};
box-shadow: inset 0 0 0 0 ${props => props.theme.primaryLight}; box-shadow: inset 0 0 0 0 ${props => props.theme.primary};
border-radius: 3px; border-radius: 3px;
outline: none; outline: none;
transition: border-color .15s, box-shadow .15s; transition: border-color .15s, box-shadow .15s;
@ -50,8 +50,8 @@ export const StyledSelect = styled.select`
background-size: 1em; background-size: 1em;
&:focus { &:focus {
border: 1px solid ${props => props.theme.primary}; border: 1px solid ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
box-shadow: inset 0 -3px 0 0 ${props => props.theme.primary}; box-shadow: inset 0 -3px 0 0 ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
} }
${props => props.small && ` ${props => props.small && `

View file

@ -32,15 +32,15 @@ export const StyledInput = styled.input`
background: ${props => props.theme.primaryBackground}; background: ${props => props.theme.primaryBackground};
color: inherit; color: inherit;
padding: 10px 14px; padding: 10px 14px;
border: 1px solid ${props => props.theme.primaryLight}; border: 1px solid ${props => props.theme.primary};
box-shadow: inset 0 0 0 0 ${props => props.theme.primaryLight}; box-shadow: inset 0 0 0 0 ${props => props.theme.primary};
border-radius: 3px; border-radius: 3px;
font-size: 18px; font-size: 18px;
outline: none; outline: none;
transition: border-color .15s, box-shadow .15s; transition: border-color .15s, box-shadow .15s;
&:focus { &:focus {
border: 1px solid ${props => props.theme.primary}; border: 1px solid ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
box-shadow: inset 0 -3px 0 0 ${props => props.theme.primary}; box-shadow: inset 0 -3px 0 0 ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
} }
`; `;

View file

@ -20,7 +20,7 @@ export const StyledSubLabel = styled.label`
export const Range = styled.div` export const Range = styled.div`
user-select: none; user-select: none;
background-color: ${props => props.theme.primaryBackground}; background-color: ${props => props.theme.primaryBackground};
border: 1px solid ${props => props.theme.primaryLight}; border: 1px solid ${props => props.theme.primary};
border-radius: 3px; border-radius: 3px;
height: 50px; height: 50px;
position: relative; position: relative;

View file

@ -9,9 +9,14 @@ export const ToggleContainer = styled.div`
border: 1px solid ${props => props.theme.primary}; border: 1px solid ${props => props.theme.primary};
border-radius: 3px; border-radius: 3px;
overflow: hidden; overflow: hidden;
--focus-color: ${props => props.theme.primary};
&:focus-within label { &:focus-within {
box-shadow: inset 0 -3px 0 0 var(--focus-color); --focus-color: ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
border: 1px solid var(--focus-color);
& label {
box-shadow: inset 0 -3px 0 0 var(--focus-color);
}
} }
& > div:first-of-type label { & > div:first-of-type label {
@ -41,8 +46,7 @@ export const HiddenInput = styled.input`
&:checked + label { &:checked + label {
color: ${props => props.theme.background}; color: ${props => props.theme.background};
background-color: ${props => props.theme.primary}; background-color: var(--focus-color);
--focus-color: ${props => props.theme.primaryDark};
} }
`; `;
@ -57,5 +61,4 @@ export const LabelButton = styled.label`
align-items: center; align-items: center;
justify-content: center; justify-content: center;
transition: box-shadow .15s; transition: box-shadow .15s;
--focus-color: ${props => props.theme.primary};
`; `;

View file

@ -17,7 +17,7 @@ export const TitleSmall = styled.span`
text-align: center; text-align: center;
font-family: 'Samurai Bob', sans-serif; font-family: 'Samurai Bob', sans-serif;
font-weight: 400; font-weight: 400;
color: ${props => props.theme.primaryDark}; color: ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
line-height: 1em; line-height: 1em;
text-transform: uppercase; text-transform: uppercase;
@ -113,7 +113,7 @@ export const Stat = styled.div`
export const StatNumber = styled.span` export const StatNumber = styled.span`
display: block; display: block;
font-weight: 900; font-weight: 900;
color: ${props => props.theme.primaryDark}; color: ${props => props.theme.mode === 'light' ? props.theme.primaryDark : props.theme.primaryLight};
font-size: 2em; font-size: 2em;
`; `;

View file

@ -15,8 +15,8 @@ const theme = {
background: '#111111', background: '#111111',
text: '#DDDDDD', text: '#DDDDDD',
primary: '#F79E00', primary: '#F79E00',
primaryDark: '#F4BB60', primaryDark: '#CC7313',
primaryLight: '#F48600', primaryLight: '#F4BB60',
primaryBackground: '#30240F', primaryBackground: '#30240F',
error: '#E53935', error: '#E53935',
loading: '#444444', loading: '#444444',