Spinner: Tweak the spinner button colors

* Tint the button text 1.777f which yields #303030 for the text color
  which produces a nice dark grey but-not-quite-black color. In testing
  black text is too dark and B_DARKEN_4_TINT (1.555f) yields #606060
  which is too light. #303030 is a compromise between the two.
* The button text gets darkened to black on mouse down and the button
  background gets darkened to B_DARKEN_1_TINT on hover as before, but
  the frame color is no longer affected --- the button frame tinted by
  B_DARKEN_1_TINT always (yielding standard Haiku button frame color).
This commit is contained in:
John Scipione 2015-06-20 16:14:53 -07:00
parent a0ba79fbff
commit 25af167e8f

View File

@ -349,13 +349,15 @@ SpinnerButton::Draw(BRect updateRect)
BView::Draw(updateRect);
float frameTint = B_DARKEN_1_TINT;
float fgTint;
if (!fIsEnabled)
fgTint = B_DARKEN_1_TINT;
else if (fIsMouseDown)
fgTint = B_DARKEN_MAX_TINT;
else
fgTint = B_DARKEN_3_TINT;
fgTint = 1.777f; // 216 --> 48.2 (48)
float bgTint;
if (fIsEnabled && fIsMouseOver)
@ -366,6 +368,7 @@ SpinnerButton::Draw(BRect updateRect)
rgb_color bgColor = ui_color(B_PANEL_BACKGROUND_COLOR);
if (bgColor.red + bgColor.green + bgColor.blue <= 128 * 3) {
// if dark background make the tint lighter
frameTint = 2.0f - frameTint;
fgTint = 2.0f - fgTint;
bgTint = 2.0f - bgTint;
}
@ -380,7 +383,7 @@ SpinnerButton::Draw(BRect updateRect)
// draw the button
be_control_look->DrawButtonFrame(this, rect, updateRect,
tint_color(bgColor, fgTint), bgColor, 0, borders);
tint_color(bgColor, frameTint), bgColor, 0, borders);
be_control_look->DrawButtonBackground(this, rect, updateRect,
tint_color(bgColor, bgTint), 0, borders);