Scroll to navigation

TICKIT_PEN_GET_COLOUR_ATTR(3) Library Functions Manual TICKIT_PEN_GET_COLOUR_ATTR(3)

NAME

tickit_pen_get_colour_attr, tickit_pen_set_colour_attr, tickit_pen_set_colour_attr_desc - manipulate a colour pen attribute

SYNOPSIS

#include <tickit.h>

int tickit_pen_get_colour_attr(TickitPen *pen, TickitPenAttr attr);
void tickit_pen_set_colour_attr(TickitPen *pen, TickitPenAttr attr, int val);
bool tickit_pen_set_colour_attr_desc(TickitPen *pen, TickitPenAttr attr,
    const char *desc);

Link with -ltickit.

DESCRIPTION

tickit_pen_get_colour_attr() returns the current value of the given colour attribute on the pen as a palette index, or -1 if that attribute is not defined.

tickit_pen_set_colour_attr() provides a new value for the given colour attribute on the pen as a palette index. If the pen previously stored a secondary RGB8 value for this attribute it will be cleared. It will invoke the TICKIT_EV_CHANGE event on the pen instance.

tickit_pen_set_colour_attr_desc() provides a new value for the given colour attribute on the pen as a textual description string, converting it into a colour index. It will invoke the TICKIT_EV_CHANGE event on the pen instance. It recognises decimal integers and the names of the first eight VGA colours (black, red, green, yellow, blue, magenta, cyan and white, respectively). It also recognises the prefix of "hi-" before one of the eight VGA colour names, to indicate the high-brightness versions at colour indexes 8 to 15. If it recognises the given string it returns a true value, or false if not.

Additionally, the string may be followed by an RGB8 specification formed from a hash symbol and 6 hexadecimal characters. If present, the secondary RGB8 value will also be set. Optional space characters between the base colour name and the hash symbol will be ignored.

For example,


tickit_pen_set_colour_attr_desc(pen, TICKIT_PEN_FG, "red #FF1515");

is eqiuvalent to setting the basic red colour along with the secondary RGB8 value of { .r = 0xFF, .g = 0x15, .b = 0x15}.

RETURN VALUE

tickit_pen_get_colour_attr() returns an integer value. tickit_pen_set_colour_attr() returns no value. tickit_pen_set_colour_attr_desc() returns a boolean indicating success.

SEE ALSO

tickit_pen_new(3), tickit_pen_has_attr(3), tickit_pen_set_bool_attr(3), tickit_pen_set_int_attr(3), tickit_pen_clear_attr(3), tickit_pen(7), tickit(7)