The Color.getHexString()
method returns the hexadecimal representation of a color in string format.
Syntax: color.getHexString()
Parameters: None
Return value: A string that represents the hexadecimal value of the color.
Example:
var color = new THREE.Color(0xff0000);
console.log(color.getHexString()); // Outputs: "ff0000"
In the above example, 0xff0000
is a hexadecimal representation of the color red. When color.getHexString()
is called, it returns "ff0000" as a string.
Note: The returned hexadecimal string is always in lowercase format.
The Color.getHexString()
method was introduced in r54
version of Three.js and is supported in all future releases.
The Color.getHexString()
method is useful when the hexadecimal value of a color is required for different applications like CSS styling, web development, graphics, etc. It provides a simple way to access the hexadecimal representation of the color in string format.