diff --git a/core/includes/common.inc b/core/includes/common.inc index 52cb151..f05211c 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2118,7 +2118,7 @@ function drupal_hex_to_rgba($hex, $alpha = FALSE) { } // The input is invalid, if alpha is not allowed but given. - if (!$alpha && !empty($rgba['alpha'])) { + if (!$alpha && isset($rgba[4])) { return FALSE; } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 7ab297a..0a47407 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -427,7 +427,6 @@ function system_element_info() { ); $types['color'] = array( '#input' => TRUE, - '#alpha' => FALSE, '#default_value' => '#000000', '#process' => array('ajax_process_form'), '#element_validate' => array('form_validate_color'), diff --git a/core/modules/system/tests/common.test b/core/modules/system/tests/common.test index 626a872..0a12240 100644 --- a/core/modules/system/tests/common.test +++ b/core/modules/system/tests/common.test @@ -2108,6 +2108,11 @@ class CommonColorConversionTestCase extends DrupalUnitTestCase { $this->assertIdentical(drupal_hex_to_rgba('#a00f', TRUE), FALSE); $this->assertIdentical(drupal_hex_to_rgba('#aa00aaf1', TRUE), FALSE); + // Test alpha values are invalid if they are not allowed. + $this->assertIdentical(drupal_hex_to_rgba('#1111'), FALSE); + $this->assertIdentical(drupal_hex_to_rgba('#22334455'), FALSE); + $this->assertIdentical(drupal_hex_to_rgba('#0000'), FALSE); + // Test bogus input. $this->assertIdentical(drupal_hex_to_rgba('#foo'), FALSE); $this->assertIdentical(drupal_hex_to_rgba('123456789'), FALSE); diff --git a/core/themes/bartik/css/style.css b/core/themes/bartik/css/style.css index 7ab3d4e..3563b44 100644 --- a/core/themes/bartik/css/style.css +++ b/core/themes/bartik/css/style.css @@ -1194,6 +1194,7 @@ input.form-email, input.form-url, input.form-search, input.form-number, +input.form-color, textarea.form-textarea, select.form-select { border: 1px solid #ccc; diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css index a3d6773..9e807d5 100644 --- a/core/themes/seven/style.css +++ b/core/themes/seven/style.css @@ -612,6 +612,7 @@ div.teaser-checkbox .form-item, .form-disabled input.form-url, .form-disabled input.form-search, .form-disabled input.form-number, +.form-disabled input.form-color, .form-disabled input.form-file, .form-disabled textarea.form-textarea, .form-disabled select.form-select { @@ -703,6 +704,7 @@ input.form-email, input.form-url, input.form-search, input.form-number, +input.form-color, input.form-file, textarea.form-textarea, select.form-select { @@ -721,6 +723,7 @@ input.form-email:focus, input.form-url:focus, input.form-search:focus, input.form-number:focus, +input.form-color:focus, input.form-file:focus, textarea.form-textarea:focus, select.form-select:focus {