| 1 |
/* color.cc |
| 2 |
* This file is part of ncursesxx library |
| 3 |
* Copyright (c) 2003,2004 by Stanislav Ievlev |
| 4 |
* |
| 5 |
* This file is covered by the GNU Library General Public License, |
| 6 |
* which should be included with libncursesxx as the file COPYING. |
| 7 |
*/ |
| 8 |
#include <ndk/color.hh> |
| 9 |
|
| 10 |
#include <ndk/application.hh> |
| 11 |
|
| 12 |
#include <bitset> |
| 13 |
|
| 14 |
using ndk::color; |
| 15 |
|
| 16 |
static std::bitset<64> initialised; |
| 17 |
|
| 18 |
color::color (short fg, short bg, attr_t attr) |
| 19 |
: attr_ (attr) |
| 20 |
, num_ (fg * 8 + bg + 1) |
| 21 |
{ |
| 22 |
if (app->has_colors ()) |
| 23 |
if (!initialised[num_ - 1]) |
| 24 |
{ |
| 25 |
initialised[num_ - 1] = true; |
| 26 |
return_unless (init_pair (num_, fg, bg) == OK); |
| 27 |
} |
| 28 |
} |