function set_enp_button_color($value) { $hex = false; // validate the hex value if (enp_validate_color($value) === true) { $hex = $value; } return $hex; }
function enp_hex_check_and_return_color($value, $percent) { $hex = false; // validate the hex value if (enp_validate_color($value) === true) { $hex = $value; } else { // the value is invalid, so let's try to create a valid one // check to see if there's a main color or not $base_button_color = get_option('enp_button_color'); // check to validate that color if (!empty($base_button_color) && enp_validate_color($base_button_color) === true) { // change the hex to darken/lighten $hex = enp_color_luminance($base_button_color, $percent); } } return $hex; }