From 8e7c430344cafe586d0138fcf46d68ca1289db8a Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 18 Dec 2020 15:52:25 +0000 Subject: [PATCH] CtrlLib: Improved tooltip colors in gtk3 (thanks klugier) git-svn-id: svn://ultimatepp.org/upp/trunk@15608 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/ChGtk3.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/uppsrc/CtrlLib/ChGtk3.cpp b/uppsrc/CtrlLib/ChGtk3.cpp index 286ac463c..28b5a2187 100644 --- a/uppsrc/CtrlLib/ChGtk3.cpp +++ b/uppsrc/CtrlLib/ChGtk3.cpp @@ -299,14 +299,18 @@ void ChHostSkin() SColorHighlightText_Write(GetInkColor()); Gtk_New("label.view"); SColorLabel_Write(GetInkColor()); -#if 0 - Gtk_New("tooltip.background"); - SColorInfo_Write(GetBackgroundColor()); - SColorInfoText_Write(GetInkColor()); -#else - SColorInfo_Write(IsDark(SColorText()) ? LtYellow() : GrayColor(79)); - SColorInfoText_Write(SColorText()); -#endif + + Color tooltip_ink, tooltip_paper; + Gtk_New("tooltip.background"); + tooltip_paper = GetBackgroundColor(); + Gtk_New("tooltip.color"); + tooltip_ink = GetInkColor(); + if(Diff(tooltip_paper, tooltip_ink) < 100) { // ink color too close to background color, fix it + tooltip_paper = IsDark(SColorText()) ? LtYellow() : GrayColor(79); + tooltip_ink = SColorText();; + } + SColorInfo_Write(tooltip_paper); + SColorInfoText_Write(tooltip_ink); ChBaseSkin();