Returns an icon 80% more dark
553877
def get_darker_image(self):
        """"""
        icon_pressed = self.icon.copy()

        for x in range(self.w):
            for y in range(self.h):
                r, g, b, *_ = tuple(self.icon.get_at((x, y)))
                const = 0.8
                r = int(const * r)
                g = int(const * g)
                b = int(const * b)
                icon_pressed.set_at((x, y), (r, g, b))

        return icon_pressed
1186031
function () {
            var messageTypes = this.data.messageTypes;
            var res = this.DEFAULT_ICON;
            var icons = this.ICONS;
            for (var i = 0, l = icons.length; i < l; i++) {
                var curIcon = icons[i];
                if (messageTypes[curIcon.type] > 0) {
                    res = curIcon.icon;
                    break;
                }
            }
            return res;
        }
597753
def icon(self):
        
        if isinstance(self._icon, str):
            if QtGui.QIcon.hasThemeIcon(self._icon):
                return QtGui.QIcon.fromTheme(self._icon)
            else:
                return QtGui.QIcon(self._icon)
        elif isinstance(self._icon, tuple):
            return QtGui.QIcon.fromTheme(self._icon[0],
                                         QtGui.QIcon(self._icon[1]))
        elif isinstance(self._icon, QtGui.QIcon):
            return self._icon
        return QtGui.QIcon()
988960
def red(cls):
        ""
        wAttributes = cls._get_text_attributes()
        wAttributes &= ~win32.FOREGROUND_MASK
        wAttributes |=  win32.FOREGROUND_RED
        cls._set_text_attributes(wAttributes)
967503
def light(cls):
        ""
        wAttributes = cls._get_text_attributes()
        wAttributes |= win32.FOREGROUND_INTENSITY
        cls._set_text_attributes(wAttributes)
275697
function(fillColor) {
            var fillColorHex = this.colorUtils.hexFromColor(fillColor),
                luminanceThreshold = 128,
                darkColor = 'black',
                lightColor = 'white',
                fillLuminance = this.colorUtils.getLuminance(fillColorHex);

            return (fillLuminance < luminanceThreshold) ? lightColor : darkColor;
        }
112505
def get_night_light_brightness(self):
        """"""
        if not self.camera_extended_properties:
            return None

        night_light = self.camera_extended_properties.get('nightLight')
        if not night_light:
            return None

        return night_light.get('brightness')
1150957
def darker(self, color, step):
        """"""
        hls = colorsys.rgb_to_hls(*self.rgb(color))
        return colorsys.hls_to_rgb(hls[0], hls[1] - step, hls[2])
149718
private Icon getEnabledIcon(AbstractButton b, Icon defaultIcon) {
        if (defaultIcon == null) {
            defaultIcon = getSynthIcon(b, SynthConstants.ENABLED);
        }

        return defaultIcon;
    }
94395
def setHoverIcon(self, icon):
        
        icon = QIcon(icon)
        if not icon.isNull():
            self._hoverIcon = QIcon(icon)
        else:
            self._hoverIcon = None
658190
def hex_is_dark(hexx, percent=50):
    
    r, g, b = hex_to_rgb(hexx)
    luma = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 2.55  # per ITU-R BT.709

    return (luma < percent)
600
function getColorLightenFunction(less) {

  function rgba() {
    var rgbaFunc = less.functions.functionRegistry.get("rgba");
    return rgbaFunc.apply(null, arguments);
  }

  return function (color, amount) {
    var baseRGB = [255, 255, 255];
    var value = amount.value / 100;

    if (value < 0) {
      baseRGB = [0, 0, 0];
      value = -1 * value;
    }

    return rgba(
      Math.round((baseRGB[0] - color.rgb[0]) * value) + color.rgb[0],
      Math.round((baseRGB[1] - color.rgb[1]) * value) + color.rgb[1],
      Math.round((baseRGB[2] - color.rgb[2]) * value) + color.rgb[2],
      color.alpha
    );
  };
}
426797
def brightness(frames):
        """"""
        reader = MessageReader(frames)
        res = reader.string("command").uint32("brightness").assert_end().get()
        if res.command != "brightness":
            raise MessageParserError("Command is not 'brightness'")
        return (res.brightness/1000,)
416431
function parseIcon(icon = "none") {
  if (!!icon && icon !== "none") {
    if (typeof icon === "string") {
      return { icon, position: "left", style: {} };
    }

    return { position: "left", style: {}, ...icon };
  }

  return null;
}
479383
def text_colour_for_hex(hexx, percent=50, dark='#000000', light='#ffffff'):
    
    return light if hex_is_dark(hexx, percent=percent) else dark
1326083
function setBrightnessOfLed(callback) {
    var ledIndex = 8;
    
    var setBrightnessOfLedInterval = setInterval(function() {
        if (ledIndex >= 0) {
            dot3k.barGraph.setBrightnessOfLed(ledIndex, 0);
            
            ledIndex--;
        } else {
            clearInterval(setBrightnessOfLedInterval);
            
            if (callback) {
                callback();
            }
        }
    }, 500);
}
812516
def _make_icon(cls, status):
        
        icon = cls.ICONS[status]
        if isinstance(icon, tuple):
            return QtGui.QIcon.fromTheme(
                icon[0], QtGui.QIcon(icon[1]))
        elif isinstance(icon, str):
            return QtGui.QIcon(icon)
        elif isinstance(icon, QtGui.QIcon):
            return icon
        else:
            return None