From Adrien Destugues <pulkomandy@xxxxxxxxx>:
Adrien Destugues has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/3407 ;)
Change subject: tracker kit: make desktop color selection try user color first
......................................................................
tracker kit: make desktop color selection try user color first
---
M src/kits/tracker/PoseView.cpp
1 file changed, 19 insertions(+), 11 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/07/3407/1
diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp
index cf88c37..f5db8a2 100644
--- a/src/kits/tracker/PoseView.cpp
+++ b/src/kits/tracker/PoseView.cpp
@@ -9034,20 +9034,28 @@
rgb_color
BPoseView::DeskTextColor() const
{
+ rgb_color fg_color = ui_color(B_DOCUMENT_TEXT_COLOR);
rgb_color color = ViewColor();
- float thresh = color.red + (color.green * 1.25f) + (color.blue * 0.45f);
+ float color_thresh = abs(fg_color.red - color.red)
+ + abs(fg_color.green - color.green)
+ + abs(fg_color.blue - color.blue);
+ if (color_thresh > 120) {
+ return fg_color;
+ } else {
+ float thresh = color.red + (color.green * 1.25f) + (color.blue
* 0.45f);
- if (thresh >= 360) {
- color.red = 0;
- color.green = 0;
- color.blue = 0;
- } else {
- color.red = 255;
- color.green = 255;
- color.blue = 255;
+ if (thresh >= 360) {
+ color.red = 0;
+ color.green = 0;
+ color.blue = 0;
+ } else {
+ color.red = 255;
+ color.green = 255;
+ color.blue = 255;
+ }
+
+ return color;
}
-
- return color;
}
--
To view, visit https://review.haiku-os.org/c/haiku/+/3407
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I47392bdafe8ecf1996886fd0a8324a114f4524fd
Gerrit-Change-Number: 3407
Gerrit-PatchSet: 1
Gerrit-Owner: Adrien Destugues <pulkomandy@xxxxxxxxx>
Gerrit-MessageType: newchange