From the course: Exploring C Libraries
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Making color text
- [Man] Each character position on the Ncurses screen is occupied by a character and an attribute. In this exercise file, three common attributes are activated for basic text. Bold, reverse and underline. The setup works the same for each attribute. The attron function sets the text attribute, which applies to any text output afterwards, as you see done here in line ten with the bold attribute. At line 13, the attroff function disables the attribute. Two similar clusters of code activate two more attributes, reverse text and underline. I've already compiled and built the code, so let's see what it does. And here on the AnchorASUS screen, you see the text output bold, reversed and underlined. On some terminals, underlined text might appear blue. Attributes can also apply color to text, but only if the terminal window is configured for color. In this exercise file, the has_colors functions at line eight returns true if…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.