diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2020-05-23 21:31:05 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2020-05-23 21:33:42 +0100 |
commit | 3626a5654e858ca6915327628e58a09e938392f4 (patch) | |
tree | c149843f95c40376f3878a1c1a3da8d4127321ae /include/netsurf | |
parent | 60f8f0126d49dc5313d44858e9b4da0aeb1f5697 (diff) | |
download | netsurf-3626a5654e858ca6915327628e58a09e938392f4.tar.gz netsurf-3626a5654e858ca6915327628e58a09e938392f4.tar.bz2 |
Plot style: Helper macro to get nearest of black and white.
Diffstat (limited to 'include/netsurf')
-rw-r--r-- | include/netsurf/plot_style.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/netsurf/plot_style.h b/include/netsurf/plot_style.h index 15069a52b..c4060926b 100644 --- a/include/netsurf/plot_style.h +++ b/include/netsurf/plot_style.h @@ -170,6 +170,11 @@ typedef struct plot_font_style { (((c0 & 0x00ff00) * 151) >> 16) + \ (((c0 & 0xff0000) * 28) >> 24)) +/* Choose either black or white, depending on which is nearest to the + * percieved lightness of the supplied colour, c0. */ +#define colour_to_bw_nearest(c0) \ + ((colour_lightness(c0) > (0xff / 2)) ? 0xffffff : 0x000000) + /* 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) \ |