public function ColorTest::providerTestRbgToHex in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Utility/ColorTest.php \Drupal\Tests\Component\Utility\ColorTest::providerTestRbgToHex()
Data provider for testRgbToHex().
Return value
array An array of arrays containing:
- The rgb color array value.
- The hex color value.
See also
testRgbToHex()
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ ColorTest.php, line 107 - Contains \Drupal\Tests\Component\Utility\ColorTest.
Class
- ColorTest
- Tests Color utility class conversions.
Namespace
Drupal\Tests\Component\UtilityCode
public function providerTestRbgToHex() {
// Input using named RGB array (e.g., as returned by Color::hexToRgb()).
$tests = array(
array(
array(
'red' => 0,
'green' => 0,
'blue' => 0,
),
'#000000',
),
array(
array(
'red' => 255,
'green' => 255,
'blue' => 255,
),
'#ffffff',
),
array(
array(
'red' => 119,
'green' => 119,
'blue' => 119,
),
'#777777',
),
array(
array(
'red' => 1,
'green' => 2,
'blue' => 3,
),
'#010203',
),
);
// Input using indexed RGB array (e.g.: array(10, 10, 10)).
foreach ($tests as $test) {
$tests[] = array(
array_values($test[0]),
$test[1],
);
}
// Input using CSS RGB string notation (e.g.: 10, 10, 10).
foreach ($tests as $test) {
$tests[] = array(
implode(', ', $test[0]),
$test[1],
);
}
return $tests;
}