summaryrefslogtreecommitdiff
path: root/src/ui/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/text.c')
-rw-r--r--src/ui/text.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index 3fe56b59..b610d3b8 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -702,11 +702,20 @@ static iColor fgColor_AttributedRun_(const iAttributedRun *d) {
702 iColor fg = d->fgColor_; 702 iColor fg = d->fgColor_;
703 const iHSLColor themeBg = get_HSLColor(tmBackground_ColorId); 703 const iHSLColor themeBg = get_HSLColor(tmBackground_ColorId);
704 const float bgLuminance = luma_Color(get_Color(tmBackground_ColorId)); 704 const float bgLuminance = luma_Color(get_Color(tmBackground_ColorId));
705 /* TODO: Actually this should check if the FG is too close to the BG, and
706 either darken or brighten the FG. Now it only accounts for nearly black/white
707 backgrounds. */
708 if (bgLuminance < 0.1f) {
709 /* Background is dark. Lighten the foreground. */
710 iHSLColor fgHsl = hsl_Color(fg);
711 fgHsl.lum = iMax(0.2f, fgHsl.lum);
712 return rgb_HSLColor(fgHsl);
713 }
705 if (bgLuminance > 0.4f) { 714 if (bgLuminance > 0.4f) {
706 float dim = (bgLuminance - 0.4f); 715 float dim = (bgLuminance - 0.4f);
707 fg.r *= 0.5f * dim; 716 fg.r *= 1.0f * dim;
708 fg.g *= 0.5f * dim; 717 fg.g *= 1.0f * dim;
709 fg.b *= 0.5f * dim; 718 fg.b *= 1.0f * dim;
710 } 719 }
711 if (themeBg.sat > 0.15f && themeBg.lum >= 0.5f) { 720 if (themeBg.sat > 0.15f && themeBg.lum >= 0.5f) {
712 iHSLColor fgHsl = hsl_Color(fg); 721 iHSLColor fgHsl = hsl_Color(fg);