Example #1
0
 /**
  * {@inheritdoc}
  */
 public function validateConfigurationForm(array &$form, array &$form_state)
 {
     if (!Color::validateHex($form_state['values']['bgcolor'])) {
         form_set_error('bgcolor', $form_state, $this->t('Background color must be a hexadecimal color value.'));
     }
 }
Example #2
0
 /**
  * Tests Color::rgbToHex().
  *
  * @param string $value
  *   The rgb color value.
  * @param string $expected
  *   The expected hex color value.
  *
  * @dataProvider providerTestRbgToHex
  */
 public function testRgbToHex($value, $expected)
 {
     $this->assertSame($expected, Color::rgbToHex($value));
 }