nsnake
Classic snake game for the terminal
Colors.hpp
1 #ifndef COLORS_H_DEFINED
2 #define COLORS_H_DEFINED
3 
4 #include <ncurses.h>
5 #include <string>
6 
7 typedef short Color;
8 typedef chtype ColorPair;
9 
10 #define COLOR_DEFAULT -1
11 
13 namespace Colors
14 {
15  bool init();
16 
17  Color rgb(short r, short g, short b);
18 
19  Color hex(std::string hex);
20 
21  ColorPair pair(Color foreground, Color background, bool is_bold=false);
22 
23  Color fromString(std::string str);
24 
25  ColorPair pairFromString(std::string foreground, std::string background, bool is_bold=false);
26 
27  void activate(WINDOW* window, Color foreground, Color background);
28 
29  void pairActivate(WINDOW* window, ColorPair color);
30 
31  // Var
32  extern bool hasColors;
33 };
34 
35 #endif //COLORS_H_DEFINED
36 
void init()
Allocates necessary variables.
Definition: Globals.cpp:82