1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

LibGUI: Transfer "color has alpha channel" state

This commit is contained in:
Andreas Kling 2020-04-29 16:22:09 +02:00
parent 51df4bdbfc
commit f8069418e1
4 changed files with 8 additions and 17 deletions

View file

@ -223,7 +223,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
m_html_text = html_container.add<GUI::TextBox>();
m_html_text->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
m_html_text->set_text(m_color.to_string());
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_string() : m_color.to_string_without_alpha());
m_html_text->on_change = [this]() {
auto color_name = this->m_html_text->text();
auto optional_color = Color::from_string(color_name);
@ -299,7 +299,7 @@ void ColorPicker::update_color_widgets()
m_preview_widget->set_palette(pal);
m_preview_widget->update();
m_html_text->set_text(m_color.to_string());
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_string() : m_color.to_string_without_alpha());
m_red_spinbox->set_value(m_color.red());
m_green_spinbox->set_value(m_color.green());