tickit_pen_get_colour_attr_rgb8, tickit_pen_set_colour_attr_rgb8, tickit_pen_has_attr_rgb8 - manipulate a secondary RGB8 colour pen colour attribute


#include <tickit.h> 
typedef struct {
    uint8_t r;
    uint8_t g;
    uint8_t b;
} TickitPenRGB8; 
TickitPenRGB8 tickit_pen_get_colour_attr_rgb8(const TickitPen *pen,
    TickitPenAttr attr);
void tickit_pen_set_colour_attr_rgb8(TickitPen *pen,
    TickitPenAttr attr, TickitPenRGB8 value); 
bool tickit_pen_has_attr_rgb8(const TickitPen *pen,
    TickitPenAttr attr);

Link with -ltickit.


tickit_pen_get_colour_attr_rgb8() returns the current secondary RGB8 value of the given colour attribute. If the attribute is not defined or does not have a secondary RGB8 value, the return value is not specified.

tickit_pen_set_colour_attr_rgb8() provides a new value for the secondary RGB8 value of the given colour attribute on the pen. This will only be stored if the pen already has a (primary) index value set for the corresponding attribute. It will invoke the TICKIT_EV_CHANGE event on the pen instance if it successfully stores the value.

tickit_pen_has_colour_attr_rgb8() returns true if the pen instance currently stores a secondary RGB8 value for the given colour attribute.


A pen instance will only store a secondary RGB8 value if a primary index value is already set. Additionally, calling tickit_pen_set_colour_attr(3) will clear an associated secondary RGB8 value. This design aims to encourage that any use of an RGB8 colour also has an index as well, to support the majority of terminals which do not in fact understand RGB8 values. It is recommended that applications wishing to make use of these values should set both at the same time, in sequence.

  tickit_pen_set_colour_attr(pen, index);
      (TickitPenRGB8){.r = red, .g = green, .b = blue});


tickit_pen_get_colour_attr_rgb8() returns a three-field colour value structure. tickit_pen_set_colour_attr_rgb8() returns no value. tickit_pen_has_colour_attr_rgb8() returns a boolean.


tickit_pen_new(3), tickit_pen_set_colour_attr(3), tickit_pen_clear_attr(3), tickit_pen(7), tickit(7)