import chroma from "chroma-js"; import React, { useMemo } from "react"; import { cn } from "../../utils/bem"; import { asVars } from "../../utils/styles"; import "./Label.prefix.css"; export const Label = React.forwardRef( ( { className, style, color, empty = false, hidden = false, selected = false, margins = false, onClick, children, hotkey, ...rest }, ref, ) => { const styles = useMemo(() => { if (!color) return null; const background = chroma(color).alpha(0.15); return { ...(style ?? {}), ...asVars({ color, background, }), }; }, [color]); return ( {children} {hotkey ? {hotkey} : null} ); }, );