Commit a992121d authored by Christian Nassif-Haynes's avatar Christian Nassif-Haynes Committed by Robert Roth

Random colors for new cores

parent 1ed8c4c5
......@@ -7,6 +7,7 @@
#include <glibtop/cpu.h>
#include <glibtop/sysinfo.h>
#include <signal.h>
#include <stdlib.h>
#include "application.h"
#include "procdialogs.h"
......@@ -100,7 +101,12 @@ apply_cpu_color_settings(Gio::Settings& settings, GsmApplication* app)
g_variant_builder_add_value ( &builder, child);
g_variant_unref (child);
} else {
color = g_strdup ("#f25915e815e8");
// Choose bytes less than 0xff because light colors are hard to see.
unsigned int r = rand() % 0xdd + 1;
unsigned int g = rand() % 0xdd + 1;
unsigned int b = rand() % 0xdd + 1;
color = g_strdup_printf("#%02x%02x%02x", r, g, b);
g_variant_builder_add(&builder, "(us)", i, color);
}
gdk_rgba_parse(&app->config.cpu_color[i], color);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment