@krowdy/kds-assets
Version:
React components that implement Google's Material Design.
46 lines (38 loc) • 956 B
JavaScript
import { useTheme } from '@krowdy/kds-core';
import { useMemo } from 'react';
const useGetColor = ({
color
}) => {
const theme = useTheme();
const colorCustom = useMemo(() => {
let colorCustom = color !== null && color !== void 0 ? color : theme.palette.krowdy[300];
switch (color) {
case 'primary':
{
colorCustom = theme.palette.primary.main;
break;
}
case 'secondary':
{
colorCustom = theme.palette.secondary.main;
break;
}
case 'custom':
{
if (theme.palette.custom && theme.palette.custom[300]) {
colorCustom = theme.palette.custom[300];
break;
}
colorCustom = theme.palette.krowdy[300];
break;
}
default:
{
break;
}
}
return colorCustom;
}, [color, theme.palette]);
return colorCustom;
};
export default useGetColor;