12 atrybut const bombki[] = {
15 {A_BOLD, COLOR_YELLOW},
16 {A_BOLD, COLOR_MAGENTA},
18 {A_BOLD, COLOR_WHITE},
20 int const ile_b = sizeof bombki / sizeof *bombki;
22 atrybut const choinka = {0, COLOR_GREEN};
23 atrybut const podstawa = {0, COLOR_YELLOW};
24 atrybut const podpis = {A_BOLD, COLOR_RED};
25 atrybut const gwiazdka = {A_BOLD, COLOR_YELLOW};
27 char const rysunek[] =
38 void ustaw(atrybut const* attr)
40 static atrybut ostatni = {-1, -1};
41 if (ostatni.attr == attr->attr && ostatni.kolor == attr->kolor) return;
43 if (attr->attr & A_BOLD) {
44 putp(enter_bold_mode);
46 putp(exit_attribute_mode);
48 putp(tparm(set_a_foreground, attr->kolor));
54 setupterm(NULL, 1, NULL);
55 atrybut const* kolor = &choinka;
56 for (int i = 0; rysunek[i] != '\0'; i++) {
58 if (c == '[') kolor = &podstawa;
59 atrybut const* akt = kolor;
60 if (c >= 'a' && c <= 'z') akt = &podpis;
61 if (c == '.') akt = &bombki[rand() % ile_b];
62 if (c == '*') akt = &gwiazdka;
63 if (c == ']') kolor = &choinka;
67 putp(exit_attribute_mode);