Support » Plugin: Search Everything » Getting error when using Hex color for highlight

  • When I use a Hex color for the highlight color it returns an error when submitting. It only takes named colors.

    Error I’m getting

    “Oops, there are errors in your submit:
    field Highlight Background Color should be a css color (‘red’ or ‘#abc123’)

    http://imgur.com/a/hXmSB

    I tried every combination of
    ‘E74198’
    ‘#E74198’
    E74198
    #E74198 <- this is the one that should work for sure

    All these error out. I had to choose from the list of official color names.

    https://www.w3schools.com/colors/colors_names.asp

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I did more testing, looks like the issue is it doesn’t take capital letters, whether it’s part of a named color or in the hex value. Seems like a simple fix. Perhaps I’ll submit a fix for it.

    Here’s one way to fix it. Update the regex for “color” to include A-Z and A-F, respectively. Inside search-everything/options.php.

    function se_validation($validation_rules) {
    $regex = array(
    “color” => “^(([a-zA-Z]+)|(#[0-9a-fA-F]{2,6}))?$”,
    “numeric-comma” => “^(\d+(, ?\d+)*)?$”,
    “css” => “^(([a-zA-Z-])+\ *\:[^;]+; *)*$”
    );

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.