diff keyboard_colors/psutilx/psutilx.py @ 3:eb2aa09653bd default tip

beginnings of CPU colors, daemon
author Brad Greco <brad@bgreco.net>
date Mon, 29 Mar 2021 20:27:09 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/keyboard_colors/psutilx/psutilx.py	Mon Mar 29 20:27:09 2021 -0400
@@ -0,0 +1,17 @@
+import psutil
+from keyboard_colors.color_profile import ColorProfileBase, Color
+
+
+class ColorProfile(ColorProfileBase):
+
+    type_name = 'Custom colors'
+    color_scale = {
+        0:   Color.from_hex('#00FF00'),
+        100: Color.from_hex('#FF0000'),
+    }
+
+    def __init__(self):
+        super().__init__()
+
+    def next_color(self):
+        return self.color_scale_value(psutil.cpu_percent())