summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box_textarea.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/render/box_textarea.c b/render/box_textarea.c
index 7f38ade5e..3109904d0 100644
--- a/render/box_textarea.c
+++ b/render/box_textarea.c
@@ -266,14 +266,9 @@ bool box_textarea_create_textarea(html_content *html,
ta_setup.text = fstyle;
ta_setup.text.background = NS_TRANSPARENT;
/* Make selected text either black or white, as gives greatest contrast
- * with background colour. (Calc lightness of background colour and
- * choose the one the lightness is furthest from.) */
- ta_setup.selected_text =
- (((((fstyle.foreground & 0x0000ff) ) * 19) / 64 +
- (((fstyle.foreground & 0x00ff00) >> 8) * 38) / 64 +
- (((fstyle.foreground & 0xff0000) >> 16) * 7) / 64) >
- (0xff / 2)) ? 0x000000 : 0xffffff;
+ * with background colour. */
ta_setup.selected_bg = fstyle.foreground;
+ ta_setup.selected_text = colour_to_bw_furthest(ta_setup.selected_bg);
/* Hand reference to dom text over to gadget */
gadget->data.text.initial = dom_text;