summaryrefslogtreecommitdiff
path: root/include/netsurf/plot_style.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/netsurf/plot_style.h')
-rw-r--r--include/netsurf/plot_style.h5
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) \