Merge pull request #155 from unix/status-color

fix: prevent main color change in special types
This commit is contained in:
witt
2020-04-30 01:14:33 +08:00
committed by GitHub
4 changed files with 12 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ exports[`Note should work with different styles 1`] = `
font-size: 14px;
line-height: 1.8;
border: 1px solid #0070f3;
color: #fff;
color: white;
background-color: #0070f3;
border-radius: 5px;
}

View File

@@ -37,9 +37,9 @@ const getStatusColor = (type: NormalTypes, filled: boolean, theme: ZeitUIThemes)
borderColor: statusColor || theme.palette.border,
bgColor: theme.palette.background,
}
const filledColor = statusColor ? 'white' : theme.palette.background
return {
color: theme.palette.background,
color: filledColor,
borderColor: statusColor || theme.palette.foreground,
bgColor: statusColor || theme.palette.foreground,
}

View File

@@ -189,7 +189,7 @@ exports[`UseToast should work with different types 1`] = `
align-items: center;
color: #000;
background-color: #0070f3;
color: #fff;
color: white;
border: 0;
border-radius: 5px;
padding: 16pt;

View File

@@ -39,13 +39,18 @@ const getColors = (palette: ZeitUIThemesPalette, type?: NormalTypes) => {
warning: palette.warning,
error: palette.error,
}
if (!type || type === 'default') return {
const isDefault = !type || type === 'default'
if (isDefault) return {
bgColor: colors.default,
color: palette.foreground,
}
/**
* Prevent main color change in special types.
* The color will only follow the theme when it is in the default type.
*/
return {
bgColor: colors[type],
color: palette.background,
bgColor: colors[type as NormalTypes],
color: 'white',
}
}