summaryrefslogtreecommitdiff
path: root/src/ui/color.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/color.c')
-rw-r--r--src/ui/color.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/ui/color.c b/src/ui/color.c
index 3c2f0339..824342ae 100644
--- a/src/ui/color.c
+++ b/src/ui/color.c
@@ -868,23 +868,16 @@ void ansiColors_Color(iRangecc escapeSequence, int fgDefault, int bgDefault,
868 case 97: 868 case 97:
869 fg = ansi8BitColors_[8 + arg - 90]; 869 fg = ansi8BitColors_[8 + arg - 90];
870 break; 870 break;
871 } 871 case 100:
872 } 872 case 101:
873 /* Ensure legibility if only the foreground color is set. */ 873 case 102:
874 if (fg.a) { 874 case 103:
875 const iHSLColor themeBg = get_HSLColor(tmBackground_ColorId); 875 case 104:
876 const float bgLuminance = luma_Color(get_Color(tmBackground_ColorId)); 876 case 105:
877 if (bgLuminance > 0.4f) { 877 case 106:
878 float dim = (bgLuminance - 0.4f); 878 case 107:
879 fg.r *= 0.5f * dim; 879 bg = ansi8BitColors_[8 + arg - 100];
880 fg.g *= 0.5f * dim; 880 break;
881 fg.b *= 0.5f * dim;
882 }
883 if (themeBg.sat > 0.15f && themeBg.lum >= 0.5f) {
884 iHSLColor fgHsl = hsl_Color(fg);
885 fgHsl.hue = themeBg.hue;
886 fgHsl.lum = themeBg.lum * 0.5f;
887 fg = rgb_HSLColor(fgHsl);
888 } 881 }
889 } 882 }
890 if (fg.a && fg_out) { 883 if (fg.a && fg_out) {