summaryrefslogtreecommitdiff
path: root/render/html_redraw.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-02-15 16:07:56 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-02-15 16:07:56 +0000
commit427f13a7161342c303f6ca2a758c2cec51f0e157 (patch)
tree7bcec50f2902dc56434f04ec142d69da9630891d /render/html_redraw.c
parent893eba326df24e3b7d4628885ffd51ca5d68e863 (diff)
downloadnetsurf-427f13a7161342c303f6ca2a758c2cec51f0e157.tar.gz
netsurf-427f13a7161342c303f6ca2a758c2cec51f0e157.tar.bz2
Change selection colours so selection background takes text colour, and selected text becomes black or white -- whichever gives greatest contrast.
Diffstat (limited to 'render/html_redraw.c')
-rw-r--r--render/html_redraw.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 1dbe093e8..1abe14375 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -185,7 +185,7 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
bool clip_changed = false;
bool text_visible = true;
int startx, endx;
- plot_style_t *pstyle_fill_hback = plot_style_fill_white;
+ plot_style_t pstyle_fill_hback = *plot_style_fill_white;
plot_font_style_t fstyle_hback = plot_fstyle;
if (end_idx > utf8_len) {
@@ -221,15 +221,12 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
&plot_fstyle))
return false;
- /* decide whether highlighted portion is to be
- * white-on-black or black-on-white */
- if ((fstyle->background & 0x808080) == 0x808080)
- pstyle_fill_hback = plot_style_fill_black;
+ pstyle_fill_hback.fill_colour = fstyle->foreground;
/* highlighted portion */
if (!plot->rectangle(x + startx, y, x + endx,
y + height * scale,
- pstyle_fill_hback))
+ &pstyle_fill_hback))
return false;
if (start_idx > 0) {
@@ -250,9 +247,9 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
}
fstyle_hback.background =
- pstyle_fill_hback->fill_colour;
- fstyle_hback.foreground =
- pstyle_fill_hback->fill_colour ^ 0xffffff;
+ pstyle_fill_hback.fill_colour;
+ fstyle_hback.foreground = colour_to_bw_furthest(
+ pstyle_fill_hback.fill_colour);
if (text_visible &&
!plot->text(x, y + (int)(height * 0.75 * scale),