Skip to main content

Home > blockly > utils > colour > rgbToHex

utils.colour.rgbToHex() function

Converts a colour from RGB to hex representation.

Signature:

export declare function rgbToHex(r: number, g: number, b: number): string;

Parameters

ParameterTypeDescription
rnumberAmount of red, int between 0 and 255.
gnumberAmount of green, int between 0 and 255.
bnumberAmount of blue, int between 0 and 255.

Returns:

string

Hex representation of the colour.