comparison 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
comparison
equal deleted inserted replaced
2:091a1f59a79c 3:eb2aa09653bd
1 import psutil
2 from keyboard_colors.color_profile import ColorProfileBase, Color
3
4
5 class ColorProfile(ColorProfileBase):
6
7 type_name = 'Custom colors'
8 color_scale = {
9 0: Color.from_hex('#00FF00'),
10 100: Color.from_hex('#FF0000'),
11 }
12
13 def __init__(self):
14 super().__init__()
15
16 def next_color(self):
17 return self.color_scale_value(psutil.cpu_percent())