wayak-rgb-utils
v1.0.0
Published
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
Downloads
1
Readme
Table of Contents
- RGBUtils
- numberToRGB
- RGBToNumber
- numberToRGBA
- RGBAToNumber
- stringToRGBANumber
- stringToRGBAObject
- RGBDistance
RGBUtils
numberToRGB
Transform integer number like 0xff0000 to rgb object like {r:255,g:0,b:0} inverse to RGBToNumber.
Parameters
number
integer rgb color.
Returns object a object with r,g,b props
RGBToNumber
Transform rgb values to integer number like 0xff0000 inverse to numberToRGB.
Parameters
Returns UInt32 a color in uInt32 number like 0xff0000
numberToRGBA
Transform uInt32 number like 0xff0000ff to rgb object like {r:255,g:0,b:0,a:255} inverse to RGBAToNumber.
Parameters
number
uInt32 rgba color.
Returns Object a object with r,g,b,a props
RGBAToNumber
Transform rgba values to uInt32 number like 0xff0000ff inverse to RGBAToNumber.
Parameters
r
number red value (0-255).g
number green value (0-255).b
number blue value (0-255).a
number alpha value (0-255).
Returns UInt32 a color in uInt32 number like 0xff0000ff
stringToRGBANumber
Transform a string value like '0xff0000ff' or '#ff0000' in uInt32 number like 0xff0000ff.
Parameters
string
String color string.
Returns UInt32 a color in uInt32 number like 0xff0000ff
stringToRGBAObject
Transform a string value like '0xff0000ff' or '#ff0000' in a rgba object like {r:255,g:0,b:0,a:255}.
Parameters
string
string color string.
Returns object a object with r,g,b,a props
RGBDistance
return the distance between two rgb objects
Parameters
Returns number distance