diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-02-11 00:41:22 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-02-11 00:41:22 +0000 |
commit | 99fc8d3f0dd0f9889ced412d3b855878f525907a (patch) | |
tree | dcf7796d4d2f36f96cb63a412b6ffdd37c54a9a4 /desktop/plot_style.h | |
parent | e4e2917787ad58874419c97c70a68fcbdbeb9ca0 (diff) | |
download | netsurf-99fc8d3f0dd0f9889ced412d3b855878f525907a.tar.gz netsurf-99fc8d3f0dd0f9889ced412d3b855878f525907a.tar.bz2 |
Move html textarea's selection colour chooser to plot_style.h, as it could be used elsewhere.
Diffstat (limited to 'desktop/plot_style.h')
-rw-r--r-- | desktop/plot_style.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/desktop/plot_style.h b/desktop/plot_style.h index 8f57915a9..b4e7ab8f9 100644 --- a/desktop/plot_style.h +++ b/desktop/plot_style.h @@ -64,6 +64,14 @@ (((((c0 >> 8) & 0xff) + ((c1 >> 8) & 0xff)) >> 1) << 8) | \ (((( c0 & 0xff) + ( c1 & 0xff)) >> 1) << 0) +/* Choose either black or white, depending on which is furthest from the + * percieved lightness of the supplied colour, c0. */ +#define colour_to_bw_furthest(c0) \ + ((((((c0 & 0x0000ff) * 77) >> 8) + \ + (((c0 & 0x00ff00) * 151) >> 16) + \ + (((c0 & 0xff0000) * 28) >> 24)) > \ + (0xff / 2)) ? 0x000000 : 0xffffff) + /* get a bitmap pixel (image/bitmap.h) into a plot colour */ #define pixel_to_colour(b) \ b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24) |