aboutsummaryrefslogtreecommitdiff
path: root/src/color.c
blob: b2cc7250a5cef03fc7743ab522d46c8196dd3b79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "color.h"
#include <ncurses.h>

#define COLOR3_COUNT 8

void maze_color_init()
{
    start_color();
    short colors[COLOR3_COUNT] = {COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED, COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE};
    for (short f = 0; f < COLOR3_COUNT; f++)
        for (short b = 0; b < COLOR3_COUNT; b++)
            init_pair(get_color_code(f, b), f, b);
}

short get_color_code(short foreground, short background)
{
    short code = foreground;
    code |= background << 3;
    code++;
    return code;
}