reactive_rgbcolor

The “reactive_rgbcolor” type handles RGB color effects in reaction to a button click.

It can be disabled with the following values:

  • None

  • "off"

  • "disable"

It supports hexadecimal colors:

  • #FF0000

  • FF0000

  • #F00

  • F00

RGB tuples or list (only from Python API for this one):

  • (255, 0, 0)

  • [255, 0, 0]

and named colors:

white

red

lime

blue

silver

maroon

green

navy

gray

yellow

aqua

fuchsia

black

olive

teal

purple

Device Profile

Example of a rgbcolor value type in a device profile:

profile = {

    # ...

    "settings": {

        "reactive_color": {
            "label": "Reactive color",
            "description": "Set the color of the LED in reaction to a button click",
            "cli": ["-a", "--reactive-color"],
            "report_type": usbhid.HID_REPORT_TYPE_OUTPUT,
            "command": [0x26],
            "value_type": "reactive_rgbcolor",
            "default": "off",
        },

    },

    # ...

}

CLI

Example of CLI option generated with this handler:

-a REACTIVE_COLOR, --reactive-color REACTIVE_COLOR
                      Set the color of the LEDs in reaction to a button click
                      (e.g. off, disable, red, #ff0000, ff0000, #f00, f00,
                      default: off)

Example of CLI usage:

rivalcfg --reactive-color=off
rivalcfg --reactive-color=disable
rivalcfg --reactive-color=red
rivalcfg --reactive-color=ff0000
rivalcfg --reactive-color=f00

Functions

class rivalcfg.handlers.reactive_rgbcolor.CheckColorAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None, deprecated=False)

Validate reactive colors from CLI

rivalcfg.handlers.reactive_rgbcolor.add_cli_option(cli_parser, setting_name, setting_info)

Add the given “reactive_rgbcolor” type setting to the given CLI arguments parser.

Parameters:
  • cli_parser (ArgumentParser) – An ArgumentParser instance.

  • setting_name (str) – The name of the setting.

  • setting_info (dict) – The information dict of the setting from the device profile.

rivalcfg.handlers.reactive_rgbcolor.process_value(setting_info, color)

Called by the rivalcfg.mouse.Mouse class when processing a “reactive_rgbcolor” type setting.

Parameters:
  • setting_info (dict) – The information dict of the setting from the device profile.

  • color (str,tuple,list,None) – The reactive color.

Return type:

[int, int, int]