javascript - Returning RGBA value, instead of Hex with Minicolor JS -
I'm using the jQuery plugin, which I'm working on. The problem is, although I have the color picker set to make alpha color, it still returns only 6-digit hex code, and not 8-digit hex or rgba
Here's my initialized JS
$ (function () {$ ('.color'). (Function () {$ (this) .minicolors ({opacity: true,});})}} ; I have seen in my code the following: change: function (hex, opacity) {console.log (hex + '-' + opacity ); }
But it does not seem to have anything for my value.
As you can see, setting any input to an alpha value is still 6 digits hex.
I've been stumped for a while, and official documents are not very favorable. Any ideas?
hex function
> In the RGB Object
, pass your hex value and return RGB code.
function hex 2 rgb (hex) {hex = purse (((hex inductoff ('#') & gt; -1) hex. Spring (1): hex), 16 ); Return {R: Hex & gt; & Gt; 16, G: (Hex & amp; 0x00FF00) & gt; & Gt; 8, b: (hex & amp; 0x0000ff)}; }
And call this function as:
var rgb = hex2rgb ('your hex value');
like:
var rgb = hex2rgb ('# 0088cc');
Now, you can use your RGB
object to remove RGB values, such as:
console Log (rgb.r); Console.log (rgb.g); Console.log (rgb.b);
Comments
Post a Comment