author | František Kučera <franta-hg@frantovo.cz> |
Tue, 09 Sep 2014 16:18:47 +0200 | |
changeset 25 | 95be94124ce9 |
parent 12 | 7b718fcf981c |
permissions | -rw-r--r-- |
franta-hg@12 | 1 |
#include <barvicky.h> |
franta-hg@12 | 2 |
#include <string> |
franta-hg@12 | 3 |
|
franta-hg@12 | 4 |
using namespace std; |
franta-hg@12 | 5 |
|
franta-hg@12 | 6 |
string obarvi (string text, int barva) { |
franta-hg@12 | 7 |
string zacatek; |
franta-hg@12 | 8 |
string konec; |
franta-hg@12 | 9 |
|
franta-hg@12 | 10 |
switch (barva) { |
franta-hg@12 | 11 |
case BARVA_ZELENA : |
franta-hg@12 | 12 |
zacatek = string("\033[22;32m"); |
franta-hg@12 | 13 |
konec = string("\033[0m"); |
franta-hg@12 | 14 |
break; |
franta-hg@12 | 15 |
case BARVA_CERVENA : |
franta-hg@12 | 16 |
zacatek = string("\033[22;31m"); |
franta-hg@12 | 17 |
konec = string("\033[0m"); |
franta-hg@12 | 18 |
break; |
franta-hg@12 | 19 |
dafault: |
franta-hg@12 | 20 |
zacatek = (""); |
franta-hg@12 | 21 |
konec = (""); |
franta-hg@12 | 22 |
} |
franta-hg@12 | 23 |
|
franta-hg@12 | 24 |
return zacatek + text + konec; |
franta-hg@12 | 25 |
} |
franta-hg@12 | 26 |
|
franta-hg@12 | 27 |
string obarvi (const char * text, int barva) { |
franta-hg@12 | 28 |
return obarvi(string(text), barva); |
franta-hg@12 | 29 |
} |