mirror of
https://github.com/zhigang1992/react.git
synced 2026-06-19 18:13:38 +08:00
* docs: add link to GH discussions * chore: upgrade deps * chore: update code style for prettier * chore: release v2.1.0-canary.3 * chore(deps): upgrade babel * chore: replace enzyme adapter with community repo to fit react.17 * test: updatee snapshots for auto typesetting * test(config): ignore unexported parts of the tools
30 lines
707 B
TypeScript
30 lines
707 B
TypeScript
import { SnippetTypes } from '../utils/prop-types'
|
|
import { GeistUIThemesPalette } from '../themes/presets'
|
|
|
|
export type TooltipColors = {
|
|
bgColor: string
|
|
color: string
|
|
}
|
|
|
|
export const getColors = (
|
|
type: SnippetTypes,
|
|
palette: GeistUIThemesPalette,
|
|
): TooltipColors => {
|
|
const colors: { [key in SnippetTypes]: string } = {
|
|
default: palette.background,
|
|
success: palette.success,
|
|
warning: palette.warning,
|
|
error: palette.error,
|
|
secondary: palette.secondary,
|
|
dark: palette.foreground,
|
|
lite: palette.background,
|
|
}
|
|
const color =
|
|
type === 'lite' || type === 'default' ? palette.foreground : palette.background
|
|
|
|
return {
|
|
color,
|
|
bgColor: colors[type],
|
|
}
|
|
}
|