UNPKG

linear-gradient-parser

Version:

Parses a SVG linear gradient string / parsed JSON into css background image property

9 lines (7 loc) 214 B
/** * Formats an rgba into a css rgb/a property * @returns {String} */ const formatRgb = ({ r, g, b, a = 1}) => a !== 1 ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`; export default formatRgb;