1.0.1 • Published 2 years ago

rgba-to-hex-colors v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

rgba-to-hex-colors

MIT License

rgba-to-hex-colors is a helper to convert RGBA Color String to Hex color string and back

Example

'rgba(255, 255, 255)' ==> '#FFFFFF'
'#FFFFFF' ==> 'rgba(255,255,255,0)'

Methods

MethodFunction
rgbToHexConvert RGBA to Hex color string
hexToRgbConvert Hex to RGBA color string

How to use

rgbToHex

const { rgbToHex } = require('rgba-to-hex-colors');

const hexColor = rgbToHex('rgba(255, 255, 255)');

// expected output: string '#FFFFFF'

hexToRgb

const { hexToRgb } = require('rgba-to-hex-colors');

const hexColor = hexToRgb('#FFFFFF');

// expected output: string 'rgba(255,255,255,0)'