|
@@ -292,7 +292,9 @@ void ColorPicker::build_ui_custom(Widget& root_container)
|
|
|
m_html_text->on_change = [this]() {
|
|
|
auto color_name = m_html_text->text();
|
|
|
auto optional_color = Color::from_string(color_name);
|
|
|
- if (optional_color.has_value()) {
|
|
|
+ if (optional_color.has_value() && (!color_name.starts_with("#") || color_name.length() == ((m_color_has_alpha_channel) ? 9 : 7))) {
|
|
|
+ // The color length must be 9/7 (unless it is a name like red), because:
|
|
|
+ // - If we allowed 5/4 character rgb color, the field would reset to 9/7 characters after you deleted 4/3 characters.
|
|
|
auto color = optional_color.value();
|
|
|
if (m_color == color)
|
|
|
return;
|