[haiku-commits] haiku: hrev53426 - src/kits/interface

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 30 Aug 2019 10:28:35 -0400 (EDT)

hrev53426 adds 1 changeset to branch 'master'
old head: 979676fb4e7d8b9259dc66a59e1342c61432ae8f
new head: aabebc302e9b34c10a0a65baad4cb7729adc395c
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=aabebc302e9b+%5E979676fb4e7d

----------------------------------------------------------------------------

aabebc302e9b: Interface Kit: Fix some hard-coded colors.
  
   * Fix hardcoded black color in SeparatorView that caused invisible or
     hard to read labels if you had a dark panel color. E.g MediaPrefs
   * DrawBorder in HaikuControl didn't care about dark mode. Added check
     for light/dark and changed the Tinting accordingly. We should probably
     do the same for FancyBorder style as well.
  
  Change-Id: I065211e56b0db5acd05ea287d6cacf75786f306f
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/1751
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                       [ Mikael Konradsson <mikael.konradsson@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53426
Commit:      aabebc302e9b34c10a0a65baad4cb7729adc395c
URL:         https://git.haiku-os.org/haiku/commit/?id=aabebc302e9b
Author:      Mikael Konradsson <mikael.konradsson@xxxxxxxxxxx>
Date:        Tue Aug 27 16:54:20 2019 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Fri Aug 30 14:28:32 2019 UTC

----------------------------------------------------------------------------

2 files changed, 15 insertions(+), 7 deletions(-)
src/kits/interface/HaikuControlLook.cpp |  4 ++++
src/kits/interface/SeparatorView.cpp    | 18 +++++++++++-------

----------------------------------------------------------------------------

diff --git a/src/kits/interface/HaikuControlLook.cpp 
b/src/kits/interface/HaikuControlLook.cpp
index cdbb1e1e30..5cc1148aa6 100644
--- a/src/kits/interface/HaikuControlLook.cpp
+++ b/src/kits/interface/HaikuControlLook.cpp
@@ -1725,6 +1725,10 @@ HaikuControlLook::DrawBorder(BView* view, BRect& rect, 
const BRect& updateRect,
                return;
 
        rgb_color scrollbarFrameColor = tint_color(base, B_DARKEN_2_TINT);
+       if (base.red + base.green + base.blue <= 128 * 3) {
+               scrollbarFrameColor = tint_color(base, B_LIGHTEN_1_TINT);
+       }
+
        if ((flags & B_FOCUSED) != 0)
                scrollbarFrameColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
 
diff --git a/src/kits/interface/SeparatorView.cpp 
b/src/kits/interface/SeparatorView.cpp
index 616f0b3cdf..4dc11c4f5f 100644
--- a/src/kits/interface/SeparatorView.cpp
+++ b/src/kits/interface/SeparatorView.cpp
@@ -159,10 +159,14 @@ BSeparatorView::Archive(BMessage* into, bool deep) const
 void
 BSeparatorView::Draw(BRect updateRect)
 {
-       rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+       rgb_color bgColor = ui_color(B_PANEL_BACKGROUND_COLOR);
+       rgb_color highColor = ui_color(B_PANEL_TEXT_COLOR);
+
        if (BView* parent = Parent()) {
-               if (parent->ViewColor() != B_TRANSPARENT_COLOR)
-                       base = parent->ViewColor();
+               if (parent->ViewColor() != B_TRANSPARENT_COLOR) {
+                       bgColor = parent->ViewColor();
+                       highColor = parent->HighColor();
+               }
        }
 
        BRect labelBounds;
@@ -222,14 +226,14 @@ BSeparatorView::Draw(BRect updateRect)
                                / 2);
                        bounds.bottom = bounds.top + borderSize - 1;
                        region.Exclude(bounds);
-                       be_control_look->DrawBorder(this, bounds, updateRect, 
base,
+                       be_control_look->DrawBorder(this, bounds, updateRect, 
bgColor,
                                fBorder, 0, BControlLook::B_TOP_BORDER);
                } else {
                        bounds.left = floorf((bounds.left + bounds.right + 1 - 
borderSize)
                                / 2);
                        bounds.right = bounds.left + borderSize - 1;
                        region.Exclude(bounds);
-                       be_control_look->DrawBorder(this, bounds, updateRect, 
base,
+                       be_control_look->DrawBorder(this, bounds, updateRect, 
bgColor,
                                fBorder, 0, BControlLook::B_LEFT_BORDER);
                }
                if (labelBounds.IsValid())
@@ -238,14 +242,14 @@ BSeparatorView::Draw(BRect updateRect)
                ConstrainClippingRegion(&region);
        }
 
-       SetLowColor(base);
+       SetLowColor(bgColor);
        FillRect(updateRect, B_SOLID_LOW);
 
        if (fLabel.CountChars() > 0) {
                font_height fontHeight;
                GetFontHeight(&fontHeight);
 
-               SetHighColor(0, 0, 0, 255);
+               SetHighColor(highColor);
 
                if (fOrientation == B_HORIZONTAL) {
                        DrawString(fLabel.String(), BPoint(labelBounds.left,


Other related posts:

  • » [haiku-commits] haiku: hrev53426 - src/kits/interface - waddlesplash