Skip to main content

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

Parameter

Type

Description

r

number

Amount of red, int between 0 and 255.

g

number

Amount of green, int between 0 and 255.

b

number

Amount of blue, int between 0 and 255.

Returns:

string

Hex representation of the colour.