diff --git a/src/kits/interface/TextControl.cpp b/src/kits/interface/TextControl.cpp index 4e1bfc36c9..b4a26831c4 100644 --- a/src/kits/interface/TextControl.cpp +++ b/src/kits/interface/TextControl.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -470,7 +471,8 @@ BTextControl::MessageReceived(BMessage* message) if (message->HasColor(ui_color_name(B_PANEL_BACKGROUND_COLOR)) || message->HasColor(ui_color_name(B_PANEL_TEXT_COLOR)) || message->HasColor(ui_color_name(B_DOCUMENT_BACKGROUND_COLOR)) - || message->HasColor(ui_color_name(B_DOCUMENT_TEXT_COLOR))) { + || message->HasColor(ui_color_name(B_DOCUMENT_TEXT_COLOR)) + || message->HasColor(ui_color_name(B_FAILURE_COLOR))) { _UpdateTextViewColors(IsEnabled()); } } @@ -595,8 +597,10 @@ BTextControl::MarkAsInvalid(bool invalid) else fLook &= ~BControlLook::B_INVALID; - if (look != fLook) + if (look != fLook) { + _UpdateTextViewColors(IsEnabled()); Invalidate(); + } } @@ -1045,6 +1049,18 @@ BTextControl::_UpdateTextViewColors(bool enable) if (!enable) { textColor = disable_color(textColor, ViewColor()); viewColor = disable_color(ViewColor(), viewColor); + } else if (fLook & BControlLook::B_INVALID) { + hsl_color normalViewColor = hsl_color::from_rgb(viewColor); + rgb_color failureColor = ui_color(B_FAILURE_COLOR); + hsl_color newViewColor = hsl_color::from_rgb(failureColor); + if (normalViewColor.lightness < 0.15) + newViewColor.lightness = 0.15; + else if (normalViewColor.lightness > 0.95) + newViewColor.lightness = 0.95; + else + newViewColor.lightness = normalViewColor.lightness; + + viewColor = newViewColor.to_rgb(); } fText->SetFontAndColor(&font, B_FONT_ALL, &textColor);