diff options
| author | Tanner Robison <[email protected]> | 2026-08-24 16:48:53 -0700 |
|---|---|---|
| committer | Tanner Robison <[email protected]> | 2026-08-24 17:18:51 -0700 |
| commit | c94f4b2bc1d211cdece33b1e200d8e98605a1730 (patch) | |
| tree | fc1b1b03c9f3a0639f9b61316673496ff580343a /mandelbrot_set.c | |
| parent | 831468eeddf99937514e30beaba560d00044baa8 (diff) | |
changed to nicer colors
Diffstat (limited to 'mandelbrot_set.c')
| -rw-r--r-- | mandelbrot_set.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/mandelbrot_set.c b/mandelbrot_set.c index 32c38bc..cec552f 100644 --- a/mandelbrot_set.c +++ b/mandelbrot_set.c @@ -62,10 +62,10 @@ int main(void) start_color(); use_default_colors(); // keeps terminal background color - // gradient pairs - init_pair(1, COLOR_BLUE, COLOR_BLACK); - init_pair(2, COLOR_CYAN, COLOR_BLACK); - init_pair(3, COLOR_WHITE, COLOR_BLACK); + // Galactic Void Theme (Pairs 14, 15, & 16) + init_pair(1, COLOR_CYAN, COLOR_BLACK); + init_pair(2, COLOR_BLUE, COLOR_BLACK); + init_pair(3, COLOR_MAGENTA, COLOR_BLACK); } cbreak(); @@ -234,24 +234,37 @@ static void draw_mandelbrot(const struct viewer *viewer) iteration, viewer->max_iterations); int color_pair = 0; + bool is_bold = false; if (iteration < viewer->max_iterations) { // Group iterations into bands of 8 for a smooth // ripple effect int band = (iteration / 8) % 3; - if (band == 0) + if (band == 0) { color_pair = 1; // Deep Blue - else if (band == 1) + is_bold = true; + } else if (band == 1) { color_pair = 2; // Bright Cyan - else + } else if (band == 2) { color_pair = 3; // White highlight + } } // Apply color, draw pixel, remove color - if (color_pair > 0) - attron(COLOR_PAIR(color_pair)); + if (color_pair > 0) { + attron(COLOR_PAIR(color_pair) | A_BOLD); + if (is_bold) { + attron(A_BOLD); + } + } + mvaddch(screen_y, screen_x, pixel); - if (color_pair > 0) - attroff(COLOR_PAIR(color_pair)); + + if (color_pair > 0) { + attroff(COLOR_PAIR(color_pair) | A_BOLD); + if (is_bold) { + attroff(A_BOLD); + } + } } } |
