+#include <term.h>
+#include <ncurses.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+typedef struct {
+ int attr;
+ int kolor;
+} atrybut;
+
+atrybut bombki[] = {
+ {A_BOLD, COLOR_RED},
+ {A_BOLD, COLOR_BLUE},
+ {A_BOLD, COLOR_YELLOW},
+ {A_BOLD, COLOR_MAGENTA},
+ {A_BOLD, COLOR_CYAN},
+ {A_BOLD, COLOR_WHITE},
+};
+int ile_b = sizeof bombki / sizeof *bombki;
+
+atrybut choinka = {0, COLOR_GREEN};
+atrybut podstawa = {0, COLOR_YELLOW};
+atrybut podpis = {A_BOLD, COLOR_RED};
+atrybut gwiazdka = {A_BOLD, COLOR_YELLOW};
+
+char rysunek[] =
+" *\n"
+" /.\\\n"
+" /..'\\\n"
+" /'.'\\\n"
+" /.''.'\\\n"
+" /.'.'.\\\n"
+" /'.''.'.\\\n"
+" jgs ^^^[_]^^^\n"
+;
+
+void ustaw(atrybut const* attr)
+{
+ if (attr->attr & A_BOLD) {
+ putp(enter_bold_mode);
+ } else {
+ putp(exit_attribute_mode);
+ }
+ putp(tparm(set_a_foreground, attr->kolor));
+}
+
+int main()
+{
+ srand(time(NULL));
+ setupterm(NULL, 1, NULL);
+ atrybut* kolor = &choinka;
+ for (int i = 0; rysunek[i] != '\0'; i++) {
+ char c = rysunek[i];
+ if (c == '[') kolor = &podstawa;
+ atrybut* akt = kolor;
+ if (c >= 'a' && c <= 'z') akt = &podpis;
+ if (c == '.') akt = &bombki[rand() % ile_b];
+ if (c == '*') akt = &gwiazdka;
+ if (c == ']') kolor = &choinka;
+ ustaw(akt);
+ putchar(c);
+ }
+ putp(exit_attribute_mode);
+ return 0;
+}