diff --git a/Libraries/LibGUI/GWidget.cpp b/Libraries/LibGUI/GWidget.cpp index 16961b30b2..1a07c4865b 100644 --- a/Libraries/LibGUI/GWidget.cpp +++ b/Libraries/LibGUI/GWidget.cpp @@ -569,3 +569,19 @@ void GWidget::focus_next_widget() focusable_widgets.first()->set_focus(true); } } + +void GWidget::set_backcolor(const StringView& color_string) +{ + auto color = Color::from_string(color_string); + if (!color.has_value()) + return; + set_background_color(color.value()); +} + +void GWidget::set_forecolor(const StringView& color_string) +{ + auto color = Color::from_string(color_string); + if (!color.has_value()) + return; + set_foreground_color(color.value()); +} diff --git a/Libraries/LibGUI/GWidget.h b/Libraries/LibGUI/GWidget.h index cb9f99f9a1..3c4af83d53 100644 --- a/Libraries/LibGUI/GWidget.h +++ b/Libraries/LibGUI/GWidget.h @@ -137,9 +137,8 @@ public: void set_background_color(Color color) { m_background_color = color; } void set_foreground_color(Color color) { m_foreground_color = color; } - // FIXME: Implement these. - void set_backcolor(const StringView&) {} - void set_forecolor(const StringView&) {} + void set_backcolor(const StringView&); + void set_forecolor(const StringView&); void set_autofill(bool b) { set_fill_with_background_color(b); }