\CryptoManana\Core\Traits\RandomnessRgbOutputTrait

Trait RgbOutputTrait - Reusable implementation of `RgbOutputInterface`.

Summary

Methods
Properties
Constants
getRgbColourPair()
getRgbGreyscalePair()
getRgbBlackOrWhitePair()
No public properties found
No constants found
calculateRgbArrayToHexString()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

getRgbColourPair()

getRgbColourPair(boolean  $toArray = true) : array|string

Generate a random Red-Green-Blue (RGB) colour combination using all colours.

Parameters

boolean $toArray

Flag to force array output instead of string (default => true).

Throws

\Exception

Validation errors.

Returns

array|string —

Randomly generated RGB array or hexadecimal RGB color.

getRgbGreyscalePair()

getRgbGreyscalePair(boolean  $toArray = true) : array|string

Generate a random Red-Green-Blue (RGB) colour combination using only greyscale colours.

Parameters

boolean $toArray

Flag to force array output instead of string (default => true).

Throws

\Exception

Validation errors.

Returns

array|string —

Randomly generated RGB array or hexadecimal RGB color.

getRgbBlackOrWhitePair()

getRgbBlackOrWhitePair(boolean  $toArray = true) : array|string

Generate a random Red-Green-Blue (RGB) colour combination using only black&white colours.

Parameters

boolean $toArray

Flag to force array output instead of string (default => true).

Throws

\Exception

Validation errors.

Returns

array|string —

Randomly generated RGB array or hexadecimal RGB color.

calculateRgbArrayToHexString()

calculateRgbArrayToHexString(array  $rgbColour) : string

Internal method for converting RGB integer colours to HEX notations.

Parameters

array $rgbColour

An array containing three integers between 0 and 255.

Returns

string —

The HEX representation of the RGB colour pair.