HumHub Documentation (unofficial)

Color
in package
implements ColorExtension

FinalYes
Tags
experimental

This class is experimental and does not fall under our BC promise

Table of Contents

Interfaces

ColorExtension
An extension is the only way to add new functionality to Faker.

Properties

$allColorNames  : array<string|int, string>
$numberExtension  : NumberExtension
$safeColorNames  : array<string|int, string>

Methods

__construct()  : mixed
colorName()  : string
hexColor()  : string
hslColor()  : string
hslColorAsArray()  : array<string|int, int>
rgbaCssColor()  : string
rgbColor()  : string
rgbColorAsArray()  : array<string|int, int>
rgbCssColor()  : string
safeColorName()  : string
safeHexColor()  : string

Properties

$allColorNames

private array<string|int, string> $allColorNames = ['AliceBlue', 'AntiqueWhite', 'Aqua', 'Aquamarine', 'Azure', 'Beige', 'Bisque', 'Black', 'BlanchedAlmond', 'Blue', 'BlueViolet', 'Brown', 'BurlyWood', 'CadetBlue', 'Chartreuse', 'Chocolate', 'Coral', 'CornflowerBlue', 'Cornsilk', 'Crimson', 'Cyan', 'DarkBlue', 'DarkCyan', 'DarkGoldenRod', 'DarkGray', 'DarkGreen', 'DarkKhaki', 'DarkMagenta', 'DarkOliveGreen', 'Darkorange', 'DarkOrchid', 'DarkRed', 'DarkSalmon', 'DarkSeaGreen', 'DarkSlateBlue', 'DarkSlateGray', 'DarkTurquoise', 'DarkViolet', 'DeepPink', 'DeepSkyBlue', 'DimGray', 'DimGrey', 'DodgerBlue', 'FireBrick', 'FloralWhite', 'ForestGreen', 'Fuchsia', 'Gainsboro', 'GhostWhite', 'Gold', 'GoldenRod', 'Gray', 'Green', 'GreenYellow', 'HoneyDew', 'HotPink', 'IndianRed', 'Indigo', 'Ivory', 'Khaki', 'Lavender', 'LavenderBlush', 'LawnGreen', 'LemonChiffon', 'LightBlue', 'LightCoral', 'LightCyan', 'LightGoldenRodYellow', 'LightGray', 'LightGreen', 'LightPink', 'LightSalmon', 'LightSeaGreen', 'LightSkyBlue', 'LightSlateGray', 'LightSteelBlue', 'LightYellow', 'Lime', 'LimeGreen', 'Linen', 'Magenta', 'Maroon', 'MediumAquaMarine', 'MediumBlue', 'MediumOrchid', 'MediumPurple', 'MediumSeaGreen', 'MediumSlateBlue', 'MediumSpringGreen', 'MediumTurquoise', 'MediumVioletRed', 'MidnightBlue', 'MintCream', 'MistyRose', 'Moccasin', 'NavajoWhite', 'Navy', 'OldLace', 'Olive', 'OliveDrab', 'Orange', 'OrangeRed', 'Orchid', 'PaleGoldenRod', 'PaleGreen', 'PaleTurquoise', 'PaleVioletRed', 'PapayaWhip', 'PeachPuff', 'Peru', 'Pink', 'Plum', 'PowderBlue', 'Purple', 'Red', 'RosyBrown', 'RoyalBlue', 'SaddleBrown', 'Salmon', 'SandyBrown', 'SeaGreen', 'SeaShell', 'Sienna', 'Silver', 'SkyBlue', 'SlateBlue', 'SlateGray', 'Snow', 'SpringGreen', 'SteelBlue', 'Tan', 'Teal', 'Thistle', 'Tomato', 'Turquoise', 'Violet', 'Wheat', 'White', 'WhiteSmoke', 'Yellow', 'YellowGreen']

$safeColorNames

private array<string|int, string> $safeColorNames = ['black', 'maroon', 'green', 'navy', 'olive', 'purple', 'teal', 'lime', 'blue', 'silver', 'gray', 'yellow', 'fuchsia', 'aqua', 'white']

Methods

colorName()

public colorName() : string
Tags
example

'NavajoWhite'

Return values
string

hexColor()

public hexColor() : string
Tags
example

'#fa3cc2'

Return values
string

hslColor()

public hslColor() : string
Tags
example

'340,50,20'

Return values
string

hslColorAsArray()

public hslColorAsArray() : array<string|int, int>
Tags
example

array(340, 50, 20)

Return values
array<string|int, int>

rgbaCssColor()

public rgbaCssColor() : string
Tags
example

'rgba(0,255,122,0.8)'

Return values
string

rgbColor()

public rgbColor() : string
Tags
example

'0,255,122'

Return values
string

rgbColorAsArray()

public rgbColorAsArray() : array<string|int, int>
Tags
example

'array(0,255,122)'

Return values
array<string|int, int>

rgbCssColor()

public rgbCssColor() : string
Tags
example

'rgb(0,255,122)'

Return values
string

safeColorName()

public safeColorName() : string
Tags
example

'blue'

Return values
string

safeHexColor()

public safeHexColor() : string
Tags
example

'#ff0044'

Return values
string

        
On this page

Search results