parse a brightness message
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,)
967503
def light(cls):
        ""
        wAttributes = cls._get_text_attributes()
        wAttributes |= win32.FOREGROUND_INTENSITY
        cls._set_text_attributes(wAttributes)
428130
def brightness_to_hex(self, level):
        """"""
        level_int = int(level)
        new_int = int((level_int * 255)/100)
        new_level = format(new_int, '02X')
        self.logger.debug("brightness_to_hex: %s to %s", level, str(new_level))
        return str(new_level)
705031
function brighten(alpha) {
		if (isNumber(alpha) && alpha !== 0) {
			var i;
			for (i = 0; i < 3; i++) {
				rgba[i] += pInt(alpha * 255);

				if (rgba[i] < 0) {
					rgba[i] = 0;
				}
				if (rgba[i] > 255) {
					rgba[i] = 255;
				}
			}
		}
		return this;
	}
292845
function brighten(alpha) {
		if (stops) {
			each(stops, function (stop) {
				stop.brighten(alpha);
			});
		
		} else if (isNumber(alpha) && alpha !== 0) {
			var i;
			for (i = 0; i < 3; i++) {
				rgba[i] += pInt(alpha * 255);

				if (rgba[i] < 0) {
					rgba[i] = 0;
				}
				if (rgba[i] > 255) {
					rgba[i] = 255;
				}
			}
		}
		return this;
	}
1244386
async def pixy_set_brightness(self, brightness):
        
        data = [PrivateConstants.PIXY_SET_BRIGHTNESS, brightness & 0x7f,
                (brightness >> 7) & 0x7f]
        await self._send_sysex(PrivateConstants.PIXY_CONFIG, data)
813171
def lighten_color(color, amount):
    """"""
    color = [int(col + (255 - col) * amount) for col in hex_to_rgb(color)]
    return rgb_to_hex(color)
887854
def colorize(message, color=None):
    """"""
    if not color:
        return message

    colors = {
        "green": colorama.Fore.GREEN,
        "yellow": colorama.Fore.YELLOW,
        "blue": colorama.Fore.BLUE,
        "red": colorama.Fore.RED,
    }

    return "{color}{message}{nc}".format(
        color=colors.get(color, ""), message=message, nc=colorama.Fore.RESET
    )
863366
def _color(self, color, msg):
        
        if self.useColor:
            return '{0}{1}{2}'.format(color, msg, self.RESET_SEQ)
        else:
            return msg
227149
def parse_map_Ns(self):
        """"""
        Kd = os.path.join(self.dir, " ".join(self.values[1:]))
        self.this_material.set_texture_specular_highlight(Kd)
366246
def parse_mode(mode, default_bitdepth=None):
    """"""
    # few special cases
    if mode == 'P':
        # Don't know what is pallette
        raise Error('Unknown colour mode:' + mode)
    elif mode == '1':
        # Logical
        return (True, False, 1)
    elif mode == 'I':
        # Integer
        return (True, False, 16)
    # here we go
    if mode.startswith('L'):
        grayscale = True
        mode = mode[1:]
    elif mode.startswith('RGB'):
        grayscale = False
        mode = mode[3:]
    else:
        raise Error('Unknown colour mode:' + mode)

    if mode.startswith('A'):
        alpha = True
        mode = mode[1:]
    else:
        alpha = False

    bitdepth = default_bitdepth
    if mode.startswith(';'):
        mode = mode[1:]
    if mode:
        try:
            bitdepth = int(mode)
        except (TypeError, ValueError):
            raise Error('Unsupported bitdepth mode:' + mode)
    return (grayscale, alpha, bitdepth)
989224
def _brightness(x, change:uniform):
    ""
    return x.add_(scipy.special.logit(change))
478304
function parseRgb(rgbString) {
  const rgbRegex = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*[\d.]+\s*)?\)/;
  const match = rgbRegex.exec(rgbString);
  if (match) {
    const r = match[1];
    const g = match[2];
    const b = match[3];
    return { r, g, b };
  } else {
    return null;
  }
}
550136
function parseSimpleColor(color) {
	color = normalizeColor(color);
	var matches = /^rgb\(([0-9]+), ([0-9]+), ([0-9]+)\)$/.exec(color);
	if (matches) {
		return "#"
			+ parseInt(matches[1]).toString(16).replace(/^.$/, "0$&")
			+ parseInt(matches[2]).toString(16).replace(/^.$/, "0$&")
			+ parseInt(matches[3]).toString(16).replace(/^.$/, "0$&");
	}
	return null;
}
1324034
function parseMessage(message) {
  var result = {};
  message.replace(/<xml>|<\/xml>/, '').replace(/<!\[CDATA\[(.*?)\]\]>/ig, '$1').replace(/<(\w+)>(.*?)<\/\1>/g, function (_, key, value) {
    key = key.replace(/(\w)/, function (str) { return str.toLowerCase();});
    result[key] = value;
  });

  return result;
}
1097263
def _parse_message(self, data):
        
        if TwitchChatStream._check_has_ping(data):
            self._send_pong()
        if TwitchChatStream._check_has_channel(data):
            self.current_channel = \
                TwitchChatStream._check_has_channel(data)[0]

        if TwitchChatStream._check_has_message(data):
            return {
                'channel': re.findall(r'^:.+![a-zA-Z0-9_]+'
                                      r'@[a-zA-Z0-9_]+'
                                      r'.+ '
                                      r'PRIVMSG (.*?) :',
                                      data)[0],
                'username': re.findall(r'^:([a-zA-Z0-9_]+)!', data)[0],
                'message': re.findall(r'PRIVMSG #[a-zA-Z0-9_]+ :(.+)',
                                      data)[0].decode('utf8')
            }
        else:
            return None
192441
def parse_color(color):
    
    if color is None:
        color = rcParams['color']
    if isinstance(color, str):
        return vtki.string_to_rgb(color)
    elif len(color) == 3:
        return color
    else:
        raise Exception("""
    Invalid color input
    Must ba string, rgb list, or hex color string.  For example:
        color='white'
        color='w'
        color=[1, 1, 1]
        color='#FFFFFF'""")