Created
August 23, 2020 10:49
-
-
Save CodeDrome/300b50fa958bcccf036bdf526416b932 to your computer and use it in GitHub Desktop.
ncursesdemo.c part 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------- | |
// FUNCTION colouring | |
//-------------------------------------------------------- | |
void colouring() | |
{ | |
if(has_colors()) | |
{ | |
if(start_color() == OK) | |
{ | |
init_pair(1, COLOR_YELLOW, COLOR_RED); | |
init_pair(2, COLOR_GREEN, COLOR_GREEN); | |
init_pair(3, COLOR_MAGENTA, COLOR_CYAN); | |
attrset(COLOR_PAIR(1)); | |
addstr("Yellow and red\n\n"); | |
refresh(); | |
attroff(COLOR_PAIR(1)); | |
attrset(COLOR_PAIR(2) | A_BOLD); | |
addstr("Green and green A_BOLD\n\n"); | |
refresh(); | |
attroff(COLOR_PAIR(2)); | |
attroff(A_BOLD); | |
attrset(COLOR_PAIR(3)); | |
addstr("Magenta and cyan\n"); | |
refresh(); | |
attroff(COLOR_PAIR(3)); | |
} | |
else | |
{ | |
addstr("Cannot start colours\n"); | |
refresh(); | |
} | |
} | |
else | |
{ | |
addstr("Not colour capable\n"); | |
refresh(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment