Get a padded color value in hex format (00 - FF) from an int (0-255)

Parameters

int $color: The color value.

Return value

string The color value in hex format.

1 call to ColorRGB::intToColorHex()
ColorRGB::toHex in src/ColorRGB.php
Get the color as a hex instance.

File

src/ColorRGB.php, line 170

Class

ColorRGB
RGB represents the RGB color format.

Namespace

Drupal\color_field

Code

protected function intToColorHex(int $color) : string {
    return str_pad(dechex($color), 2, '0', STR_PAD_LEFT);
}