Tracker: Override Open with... pose view text color and back color

Make TextColor() and BackColor() virtual in BPoseView so that we can
override them in subclasses. These are used to invert colors on select.

Move InvertColor() and InvertedBackColor() to Utilities.

Move Desktop...() methods to DesktopPoseView overrides, this does the
same thing but in DesktopPoseView as an override.

Add override methods to Open with... pose view. Open with... window
text color were not updating with color settings making text unreadable
in dark mode. Open with... background and text colors update based on
tooltip colors which was chosen previously.

Change-Id: Id605f1887d6018766b09a6de372b6071de8b83ea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8105
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
John Scipione
2024-08-24 18:19:16 +00:00
committed by nephele nephele
parent 946839b850
commit 9d4d102df2
8 changed files with 103 additions and 90 deletions
+1 -32
View File
@@ -210,13 +210,6 @@ CopySelectionListToEntryRefList(const PoseList* original,
}
static rgb_color
invert_color(rgb_color color)
{
return make_color(255 - color.red, 255 - color.green, 255 - color.blue);
}
// #pragma mark - BPoseView
@@ -9115,9 +9108,6 @@ BPoseView::DrawPose(BPose* pose, int32 index, bool fullDraw)
rgb_color
BPoseView::TextColor(bool selected) const
{
if (IsDesktopWindow())
return DeskTextColor();
if (selected)
return ui_color(B_DOCUMENT_BACKGROUND_COLOR);
else
@@ -9129,14 +9119,8 @@ rgb_color
BPoseView::BackColor(bool selected) const
{
if (selected) {
if (IsDesktopWindow())
return DeskTextBackColor();
return InvertedBackColor();
return InvertedBackColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
} else {
if (IsDesktopWindow())
return BView::ViewColor();
rgb_color background = ui_color(B_DOCUMENT_BACKGROUND_COLOR);
return tint_color(background,
TargetVolumeIsReadOnly() ? ReadOnlyTint(background) : B_NO_TINT);
@@ -9144,21 +9128,6 @@ BPoseView::BackColor(bool selected) const
}
rgb_color
BPoseView::InvertedBackColor() const
{
rgb_color background = ui_color(B_DOCUMENT_BACKGROUND_COLOR);
rgb_color inverted = invert_color(background);
// The colors are different enough, we can use inverted
if (rgb_color::Contrast(background, inverted) > 127)
return inverted;
// use black or white
return background.IsLight() ? kBlack : kWhite;
}
void
BPoseView::Draw(BRect updateRect)
{