def set_color(self, group, color, pct=1):
        """
        Sets brightness of LEDs in the given group to the values specified in
        color tuple. When percentage is specified, brightness of each LED is
        reduced proportionally.

        Example::

            my_leds = Leds()
            my_leds.set_color('LEFT', 'AMBER')

        With a custom color::

            my_leds = Leds()
            my_leds.set_color('LEFT', (0.5, 0.3))
        """
        # If this is a platform without LEDs there is nothing to do
        if not self.leds:
            return

        color_tuple = color
        if isinstance(color, str):
            assert color in self.led_colors, \
                "%s is an invalid LED color, valid choices are %s" % \
                (color, ', '.join(self.led_colors.keys()))
            color_tuple = self.led_colors[color]

        assert group in self.led_groups, \
            "%s is an invalid LED group, valid choices are %s" % \
            (group, ', '.join(self.led_groups.keys()))

        for led, value in zip(self.led_groups[group], color_tuple):
            led.brightness_pct = value * pct
def set_color ( self , group , color , pct = 1 ) : if not self . leds : return color_tuple = color if isinstance ( color , str ) : assert color in self . led_colors , "%s is an invalid LED color, valid choices are %s" % ( color , ', ' . join ( self . led_colors . keys ( ) ) ) color_tuple = self . led_colors [ color ] assert group in self . led_groups , "%s is an invalid LED group, valid choices are %s" % ( group , ', ' . join ( self . led_groups . keys ( ) ) ) for led , value in zip ( self . led_groups [ group ] , color_tuple ) : led . brightness_pct = value * pct
Sets brightness of LEDs in the given group to the values specified in
        color tuple. When percentage is specified, brightness of each LED is
        reduced proportionally.

        Example::

            my_leds = Leds()
            my_leds.set_color('LEFT', 'AMBER')

        With a custom color::

            my_leds = Leds()
            my_leds.set_color('LEFT', (0.5, 0.3))