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