mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-19 06:49:50 +01:00
added rgbCssColor method
This commit is contained in:
parent
9ce3d44ea2
commit
e088a2e625
@ -191,6 +191,7 @@ Each of the generator properties (like `name`, `address`, and `lorem`) are calle
|
||||
hexcolor // '#fa3cc2'
|
||||
rgbcolor // '0,255,122'
|
||||
rgbColorAsArray // array(0,255,122)
|
||||
rgbCssColor // 'rgb(0,255,122)'
|
||||
safeColorName // 'fuchsia'
|
||||
colorName // 'Gainsbor'
|
||||
|
||||
|
@ -105,6 +105,14 @@ class Color extends Base
|
||||
return implode(',', static::rgbColorAsArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'rgb(0,255,122)'
|
||||
*/
|
||||
public static function rgbCssColor()
|
||||
{
|
||||
return 'rgb(' . static::rgbColor() . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* @example 'blue'
|
||||
*/
|
||||
|
@ -23,4 +23,10 @@ class ColorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertRegExp('/^' . $regexp . ',' . $regexp . ',' . $regexp . '$/i', Color::rgbColor());
|
||||
}
|
||||
|
||||
public function testRgbCssColor()
|
||||
{
|
||||
$regexp = '([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])';
|
||||
$this->assertRegExp('/^rgb\(' . $regexp . ',' . $regexp . ',' . $regexp . '\)$/i', Color::rgbCssColor());
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user