mirror of
https://review.haiku-os.org/haiku
synced 2025-01-31 18:56:49 +01:00
DeskCalc: fix live updating of button text color
When using the panel background color, always use the matching panel text color from system preferences. When using a custom color, compute appropriate light or dark text color to go with it. Change-Id: I107731efec03a8c9661b89e26255a4fe91def79b Reviewed-on: https://review.haiku-os.org/c/haiku/+/3560 Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk> Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This commit is contained in:
parent
c8a1650c73
commit
b3099de672
@ -1376,28 +1376,22 @@ CalcView::_FlashKey(int32 key, uint32 flashFlags)
|
||||
void
|
||||
CalcView::_Colorize()
|
||||
{
|
||||
// calculate light and dark color from base color
|
||||
fLightColor.red = (uint8)(fBaseColor.red * 1.25);
|
||||
fLightColor.green = (uint8)(fBaseColor.green * 1.25);
|
||||
fLightColor.blue = (uint8)(fBaseColor.blue * 1.25);
|
||||
fLightColor.alpha = 255;
|
||||
if (fHasCustomBaseColor) {
|
||||
// keypad text color
|
||||
if (fBaseColor.Brightness() > 100)
|
||||
fButtonTextColor = (rgb_color){ 0, 0, 0, 255 };
|
||||
else
|
||||
fButtonTextColor = (rgb_color){ 255, 255, 255, 255 };
|
||||
|
||||
fDarkColor.red = (uint8)(fBaseColor.red * 0.75);
|
||||
fDarkColor.green = (uint8)(fBaseColor.green * 0.75);
|
||||
fDarkColor.blue = (uint8)(fBaseColor.blue * 0.75);
|
||||
fDarkColor.alpha = 255;
|
||||
|
||||
// keypad text color
|
||||
if (fBaseColor.Brightness() > 100)
|
||||
fButtonTextColor = (rgb_color){ 0, 0, 0, 255 };
|
||||
else
|
||||
fButtonTextColor = (rgb_color){ 255, 255, 255, 255 };
|
||||
|
||||
// expression text color
|
||||
if (fExpressionBGColor.Brightness() > 100)
|
||||
fExpressionTextColor = (rgb_color){ 0, 0, 0, 255 };
|
||||
else
|
||||
fExpressionTextColor = (rgb_color){ 255, 255, 255, 255 };
|
||||
// expression text color
|
||||
if (fExpressionBGColor.Brightness() > 100)
|
||||
fExpressionTextColor = (rgb_color){ 0, 0, 0, 255 };
|
||||
else
|
||||
fExpressionTextColor = (rgb_color){ 255, 255, 255, 255 };
|
||||
} else {
|
||||
fExpressionTextColor = ui_color(B_DOCUMENT_TEXT_COLOR);
|
||||
fButtonTextColor = ui_color(B_PANEL_TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,8 +122,6 @@ class _EXPORT CalcView : public BView {
|
||||
|
||||
// color scheme
|
||||
rgb_color fBaseColor;
|
||||
rgb_color fLightColor;
|
||||
rgb_color fDarkColor;
|
||||
rgb_color fButtonTextColor;
|
||||
rgb_color fExpressionBGColor;
|
||||
rgb_color fExpressionTextColor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user