|
| 1 | +# Color |
| 2 | + |
| 3 | +## `hexColor` |
| 4 | + |
| 5 | +Generate a random hex color. |
| 6 | + |
| 7 | +```php |
| 8 | +$faker->hexColor(); |
| 9 | + |
| 10 | +// '#ccd578', '#fafa11', '#ea3781' |
| 11 | +``` |
| 12 | + |
| 13 | +## `safeHexColor` |
| 14 | + |
| 15 | +Generate a random hex color, containing only 16 values per R, G and B. |
| 16 | + |
| 17 | +```php |
| 18 | +$faker->safeHexColor(); |
| 19 | + |
| 20 | +// '#00eecc', '#00ff88', '#00aaee' |
| 21 | +``` |
| 22 | + |
| 23 | +## `rgbColorAsArray` |
| 24 | + |
| 25 | +Generate a random RGB color, as an `array`. |
| 26 | + |
| 27 | +```php |
| 28 | +$faker->rgbColorAsArray(); |
| 29 | + |
| 30 | +// [0 => 30, 1 => 22, 2 => 177], [0 => 150, 1 => 55, 2 => 34], [0 => 219, 1 => 253, 2 => 248] |
| 31 | +``` |
| 32 | + |
| 33 | +## `rgbColor` |
| 34 | + |
| 35 | +Generate a comma-separated RGB color `string`. |
| 36 | + |
| 37 | +```php |
| 38 | +$faker->rgbColor(); |
| 39 | + |
| 40 | +// '105,224,78', '97,249,98', '24,250,221' |
| 41 | +``` |
| 42 | + |
| 43 | +## `rgbCssColor` |
| 44 | + |
| 45 | +Generate a CSS-friendly RGB color `string`. |
| 46 | + |
| 47 | +```php |
| 48 | +$faker->rgbCssColor(); |
| 49 | + |
| 50 | +// 'rgb(9,110,101)', 'rgb(242,133,147)', 'rgb(124,64,0)' |
| 51 | +``` |
| 52 | + |
| 53 | +## `rgbaCssColor` |
| 54 | + |
| 55 | +Generate a CSS-friendly RGBA (alpha channel) color `string`. |
| 56 | + |
| 57 | +```php |
| 58 | +$faker->rgbaCssColor(); |
| 59 | + |
| 60 | +// 'rgba(179,65,209,1)', 'rgba(121,53,231,0.4)', 'rgba(161,239,152,0.9)' |
| 61 | +``` |
| 62 | + |
| 63 | +## `safeColorName` |
| 64 | + |
| 65 | +Generate a CSS-friendly color name. |
| 66 | + |
| 67 | +```php |
| 68 | +$faker->safeColorName(); |
| 69 | + |
| 70 | +// 'white', 'fuchsia', 'purple' |
| 71 | +``` |
| 72 | + |
| 73 | +## `colorName` |
| 74 | + |
| 75 | +Generate a CSS-friendly color name. |
| 76 | + |
| 77 | +```php |
| 78 | +$faker->colorName(); |
| 79 | + |
| 80 | +// 'SeaGreen', 'Crimson', 'DarkOliveGreen' |
| 81 | +``` |
| 82 | + |
| 83 | +## `hslColor` |
| 84 | + |
| 85 | +Generate a random HSL color `string`. |
| 86 | + |
| 87 | +```php |
| 88 | +$faker->hslColor(); |
| 89 | + |
| 90 | +// '87,10,25', '94,24,27', '207,68,84' |
| 91 | +``` |
| 92 | + |
| 93 | +## `hslColorAsArray` |
| 94 | + |
| 95 | +Generate a random HSL color, as an `array`. |
| 96 | + |
| 97 | +```php |
| 98 | +$faker->hslColorAsArray(); |
| 99 | + |
| 100 | +// [0 => 311, 1 => 84, 2 => 31], [0 => 283, 1 => 85, 2 => 49], [0 => 57, 1 => 48, 2 => 36] |
| 101 | +``` |
0 commit comments