window: change internal color representation

This commit is contained in:
Andrzej Rybczak
2014-11-08 16:34:38 +01:00
parent 8d9ddd5ff8
commit 75bae9862e
14 changed files with 211 additions and 222 deletions

View File

@@ -21,6 +21,35 @@
#include <cassert>
#include "utility/type_conversions.h"
NC::Color charToColor(char c)
{
switch (c)
{
case '0':
return NC::Color::Default;
case '1':
return NC::Color::Black;
case '2':
return NC::Color::Red;
case '3':
return NC::Color::Green;
case '4':
return NC::Color::Yellow;
case '5':
return NC::Color::Blue;
case '6':
return NC::Color::Magenta;
case '7':
return NC::Color::Cyan;
case '8':
return NC::Color::White;
case '9':
return NC::Color::End;
default:
throw std::runtime_error("invalid character");
}
}
NC::Color stringToColor(const std::string &color)
{
NC::Color result = NC::Color::Default;

View File

@@ -26,6 +26,8 @@
#include "window.h"
#include "enums.h"
NC::Color charToColor(char c);
NC::Color stringToColor(const std::string &color);
NC::Border stringToBorder(const std::string &border);