aboutsummaryrefslogtreecommitdiffhomepage
path: root/color.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-09-19 15:37:31 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-09-19 18:45:04 -0700
commit555ff00a30b70cb84a767b60e3a5c7015815feae (patch)
treeac196a147b942c345fa5ebd802ca5add774b8139 /color.h
parent6083c6fc725727ebb25c209931a38504f9269c5c (diff)
Initial work to support for term-24bit ("true color")
Diffstat (limited to 'color.h')
-rw-r--r--color.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/color.h b/color.h
index 6e22aaed..db2fec71 100644
--- a/color.h
+++ b/color.h
@@ -8,6 +8,10 @@
#include "config.h"
#include "common.h"
+/* 24 bit color */
+struct color24_t {
+ unsigned char rgb[3];
+};
/* A type that represents a color. We work hard to keep it at a size of 4 bytes. */
class rgb_color_t
@@ -36,7 +40,7 @@ class rgb_color_t
union
{
unsigned char name_idx; //0-10
- unsigned char rgb[3];
+ color24_t color;
} data;
/** Try parsing a special color name like "normal" */
@@ -129,9 +133,12 @@ public:
/** Returns the name index for the given color. Requires that the color be named or RGB. */
unsigned char to_name_index() const;
- /** Returns the term256 index for the given color. Requires that the color be named or RGB. */
+ /** Returns the term256 index for the given color. Requires that the color be RGB. */
unsigned char to_term256_index() const;
+ /** Returns the 24 bit color for the given color. Requires that the color be RGB. */
+ color24_t to_color24() const;
+
/** Returns whether the color is bold */
bool is_bold() const
{