Alpha String to RGBa
Converts alpha strings (red.5
) to rgba (rgba(255, 0, 0, 0.5)
).
Features
Takes a colors object and a value, returning a new string which is the rgba, hex, or css color name representation calculated from the given value.
; const colorMap = aqua: '#7fdbff' blue: '#0074d9' lime: '#01ff70' navy: '#001f3f' teal: '#39cccc' olive: '#3d9970' green: '#2ecc40' red: '#ff4136' maroon: '#85144b' orange: '#ff851b' purple: '#b10dc9' yellow: '#ffdc00' fuchsia: '#f012be' gray: '#aaaaaa' white: '#ffffff' black: '#111111' silver: '#dddddd'; const getColor = ; ; // '#ff4136'; // 'rgba(255, 65, 54, 0.5)'
Getting Started
❯ yarn add alpha-string-to-rgba