view 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 source

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())