diff options
author | Thomas Adam <thomas@xteddy.org> | 2021-10-26 00:01:13 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2021-10-26 00:01:13 +0100 |
commit | 6f46f71d58d508703c29ddc50c04bb4b56603e20 (patch) | |
tree | 9ea7bdd539a666bca2cee4908d53362fcd264bc5 /colour.c | |
parent | 3934d9b24de376cf0b6868c56751b55bd2d60399 (diff) | |
parent | 197a116f5a2146309c4c6fecbd9d08d36f2be750 (diff) | |
download | rtmux-6f46f71d58d508703c29ddc50c04bb4b56603e20.tar.gz rtmux-6f46f71d58d508703c29ddc50c04bb4b56603e20.tar.bz2 rtmux-6f46f71d58d508703c29ddc50c04bb4b56603e20.zip |
Merge branch 'obsd-master' into master
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) |