diff options
author | nicm <nicm> | 2021-10-25 21:21:16 +0000 |
---|---|---|
committer | nicm <nicm> | 2021-10-25 21:21:16 +0000 |
commit | 197a116f5a2146309c4c6fecbd9d08d36f2be750 (patch) | |
tree | 41e7ff764876d23b51445c6be9194fdcea96e712 /colour.c | |
parent | eb82ad5216f1538e13f4ad7c2d36f28fedd88310 (diff) | |
download | rtmux-197a116f5a2146309c4c6fecbd9d08d36f2be750.tar.gz rtmux-197a116f5a2146309c4c6fecbd9d08d36f2be750.tar.bz2 rtmux-197a116f5a2146309c4c6fecbd9d08d36f2be750.zip |
Add a way to force a colour to RGB and a format to display it.
Diffstat (limited to 'colour.c')
-rw-r--r-- | colour.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -105,6 +105,21 @@ colour_split_rgb(int c, u_char *r, u_char *g, u_char *b) *b = c & 0xff; } +/* Force colour to RGB if not already. */ +int +colour_force_rgb(int c) +{ + if (c & COLOUR_FLAG_RGB) + return (c); + if (c & COLOUR_FLAG_256) + return (colour_256toRGB(c)); + if (c >= 0 && c <= 7) + return (colour_256toRGB(c)); + if (c >= 90 & c <= 97) + return (colour_256toRGB(8 + c - 90)); + return (-1); +} + /* Convert colour to a string. */ const char * colour_tostring(int c) |