TICKIT_PEN_NEW(3)

✨ TICKIT_PEN_NEW(3) β€” Library Functions Manual ✨

okay so bestie, welcome to the TICKIT_PEN_NEW page πŸ’… this is one of those little section-3 numbers from the Library Functions Manual, and it's literally all about making brand-new pen instances. pens. for your terminal. yes queen, styling your TUI is a whole aesthetic πŸŽ€


🌸 NAME 🌸

tickit_pen_new β€” create a new pen instance


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <tickit.h>

TickitPen *tickit_pen_new(void);
TickitPen *tickit_pen_new_attrs(...);
TickitPen *tickit_pen_clone(const TickitPen *orig);

Link with -ltickit.


πŸ’– DESCRIPTION πŸ’–

so like, three different ways to birth a pen, each with its own vibe:

  • tickit_pen_new() β€” makes you a fresh new TickitPen instance. it starts out with absolutely no attributes set, like a blank canvas bestie, a clean face before the makeup 🧚
  • tickit_pen_new_attrs() β€” makes a new TickitPen instance and fills it up with a whole list of attribute values you hand it. the attributes come in pairs: first a TickitPenAttr, then an integer giving its value, and the whole thing gets terminated by a final 0 or -1. periodt.

also there's a little plot twist here β€” two extra attribute types get recognised in this function: TICKIT_PEN_FG_DESC and TICKIT_PEN_BG_DESC. those two are expecting a string argument value instead, and that string gets parsed exactly like it would for tickit_pen_set_colour_attr_desc(3).

  • tickit_pen_clone() β€” makes a new TickitPen instance that starts out with the same attribute values set as the one you passed in as orig. it's giving twin energy fr fr πŸ‘―
okay so about the refcount, listen up: the reference count of a newly-constructed pen instance is one. you can bump it up or bring it down with tickit_pen_ref(3) and tickit_pen_unref(3). and the moment that reference count hits zero, the pen is destroyed. gone. bye. πŸ’€

πŸ”₯ RETURN VALUE πŸ”₯

if everything goes right, tickit_pen_new(), tickit_pen_new_attrs() and tickit_pen_clone() all return a pointer to the shiny new instance. 🫢

if it goes wrong? you get NULL back, and errno is set to tell you what the failure was. no cap.


πŸ‘‘ SEE ALSO πŸ‘‘

tickit_pen_ref(3), tickit_pen_unref(3), tickit_pen_bind_event(3), tickit_pen(7), tickit(7)


aaaand that's the whole page bestie, go forth and style your terminal πŸŒˆπŸ’œ

later, icon β€” this was TICKIT_PEN_NEW(3) from the Library Functions Manual, page three, and yes it slayed ✨