I have been struggling to get default color picker work. When I add a new color field ( new \Ip\Form\Field\Color) on form page then after selecting color from drop down I get error "incorrect color code". And when I checked value returned is something like this "hsv(0, 25%, 34%)".
After checking in Core files, Color Form field file then I found following function which is validating it.
public function validate($values, $valueKey, $environment)
{
if (preg_match('/^#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?$\b/', $values[$valueKey])) {
return parent::validate($values, $valueKey, $environment);
} else {
if ($environment == \Ip\Form::ENVIRONMENT_ADMIN) {
return __('Incorrect color code', 'Ip-admin', false);
} else {
return __('Incorrect color code', 'Ip', false);
}
}
}
Can you please check and let me know why it is generating HSV code for color "hsv(0, 25%, 34%)"
Thanks in advance.
And here is a complete fix :
https://github.com/impresspages/ImpressPages/commit/bb8a07c2a575479c8a4f47a61b72415e16b8510b
https://github.com/impresspages/ImpressPages/commit/ad877a5173b2d7b118e17849fed9d2ae9abc827e