The HTML for the input fields where the user enters a hexadecimal RGB-code is inadequate.

The following snippet is from color_edit_scheme_form() in the color.module file:

  foreach ($palette as $name => $value) {
    if (!$value) {
      drupal_set_message('The colors set in the scheme in the color.inc file doesn\'t correspond with the number of fields.', 'status', FALSE);
    }
    $form['palette'][$name] = array(
      '#type' => 'textfield',
      '#title' => $names[$name],
      '#default_value' => $value,
      '#size' => 8,
    );
  }

The maxlength of the textfield is not set (should be 7) which increases the level of erroneous manual input from the user.

Also the size could be increased to allow the user to see more of the selected color without the text blocking the view.

Suggestion:

  foreach ($palette as $name => $value) {
    if (!$value) {
      drupal_set_message('The colors set in the scheme in the color.inc file doesn\'t correspond with the number of fields.', 'status', FALSE);
    }
    $form['palette'][$name] = array(
      '#type' => 'textfield',
      '#title' => $names[$name],
      '#default_value' => $value,
      '#size' => 16,
      '#maxlength' => 7,
    );
  }

Comments

Danial Namousi’s picture

An issue for the corresponding CSS as been created:
http://drupal.org/node/315833

If the CSS is implemented, I suggest that also the #size is adjusted to 7 (to reflect #maxlength).