Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const useAvatarStyle = ({
size,
name,
showBorder,
borderColor,
}: AvatarOptions) => {
const { colors } = useTheme();
const { colorMode } = useColorMode();
const bg = name ? string2Hex(name) : colors.gray[400];
const color = name ? (isDarkColor(bg) ? "#fff" : "gray.800") : "#fff";
const _borderColor = { light: "#fff", dark: "gray.800" };
const baseProps = {
display: "inline-flex",
rounded: "full",
alignItems: "center",
flexShrink: "0",
justifyContent: "center",
position: "relative",
};
return {
...baseProps,
size: size ? avatarSizes[size] : null,
bg,
color,