Fabric.js toHexa() Method Last Updated : 19 Mar, 2021 Comments Improve Suggest changes Like Article Like Report The toHexa() method is used to convert any type of the specified color representation to it's HEXA (Hexadecimal alpha) representation. Syntax: toHexa() Parameters: This method does not accept any parameter. Return Value: This method returns color representation in HEXA format. Example 1: HTML <!DOCTYPE html> <html> <head> <!-- Adding the FabricJS library --> <script src= "https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js"> </script> </head> <body> <script type="text/javascript"> // Calling the toHexa() function over // the specified color values console.log(new fabric.Color("rgb(10, 120, 150)").toHexa()); console.log(new fabric.Color("hsl(5%, 10%, 250%)").toHexa()); </script> </body> </html> Output: 0A7896FF 000000FF Example 2: HTML <!DOCTYPE html> <html> <head> <!-- Adding the FabricJS library --> <script src= "https://cdnjs.cloudflare.com/ajax/libs/fabric.js/3.6.2/fabric.min.js"> </script> </head> <body> <script type="text/javascript"> // Initializing some color values in different color format var A = "rgb(0, 12, 50)"; var B = "rgba(10, 13, 250, 0.1)"; var C = "hsl(0, 100%, 50%)"; var D = "hsla(10%, 0, 0, 0.2)"; // Calling the toHexa() function over // the above specified color values console.log(new fabric.Color(A).toHexa()); console.log(new fabric.Color(B).toHexa()); console.log(new fabric.Color(C).toHexa()); console.log(new fabric.Color(D).toHexa()); </script> </body> </html> Output: 000C32FF 0A0DFA1A FF0000FF 000000FF Comment More infoAdvertise with us Next Article Fabric.js toRgba() Method K Kanchan_Ray Follow Improve Article Tags : JavaScript Web Technologies Fabric.js Similar Reads Fabric.js toHex() Method The toHex() method is used to convert any type of the specified color representation to it's HEX (Hexadecimal) representation. Syntax: toHex() Parameters: This method does not accept any parameter. Return Value: This method returns color representation in HEX format. Example 1: HTML <!DOCTYPE htm 1 min read Fabric.js toHsla() Method The toHsla() method is used to convert any type of the specified color representation to it's HSLA (hue, saturation, lightness, and alpha) representation. Syntax: toHsla() Parameters: This method does not accept any parameter. Return Value: This method returns color representation in HSLA format. Ex 1 min read Fabric.js toHsl() Method The toHsl() method is used to convert any type of the specified color representation to it's HSL (hue, saturation, and lightness) representation. Syntax: toHsl() Parameters: This method does not accept any parameter. Return Value: This method returns color representation in HSL format. Example 1: HT 1 min read Fabric.js toRgba() Method The toRgba() method is used to convert any type of the specified color representation to it's RGBA (Red Green Blue and Alpha) representation. Syntax: toRgba() Parameters: This method does not accept any parameter. Return Value: This method returns color representation in RGBA format. Example 1: HTML 1 min read Fabric.js toArray() Method The toArray() method in Fabric.js is used to convert the specified array-like objects to an array. This can be used to convert an arguments list or a NodeList to an array. Syntax: toArray( arrayLike ) Parameters: This method accepts a single parameter as mentioned above and described below: arrayLik 1 min read Fabric.js toFixed() Method The toFixed() method in Fabric.js is used to convert the specified fraction number into a rounded fixed number. Syntax: toFixed(number, fractionDigits) Parameters: This method accepts two parameters as mentioned above and described below: number: This parameter holds the fraction number.fractionDigi 1 min read Like