[gnome-system-monitor] Random colors for new cores
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Random colors for new cores
- Date: Sun, 18 Oct 2020 06:23:49 +0000 (UTC)
commit a992121dfddc67f7b99d83f502436504535955dd
Author: Christian Nassif-Haynes <DoxasticFox bitbucket org>
Date: Thu Aug 13 22:07:52 2020 +1000
Random colors for new cores
src/application.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/application.cpp b/src/application.cpp
index 7dff723f..e42fd8a1 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]