Write an Colour Specification box to file.
483741
def write(self, fptr):
        
        self._write_validate()
        length = 15 if self.icc_profile is None else 11 + len(self.icc_profile)
        fptr.write(struct.pack('>I4s', length, b'colr'))

        read_buffer = struct.pack('>BBBI',
                                  self.method,
                                  self.precedence,
                                  self.approximation,
                                  self.colorspace)
        fptr.write(read_buffer)
28518
def writeinfo(self, linelist, colour = None):
        
        
        self.checkforpilimage()
        colour = self.defaultcolour(colour)
        self.changecolourmode(colour)
        self.makedraw()
        
        self.loadinfofont()
        
        
        for i, line in enumerate(linelist):
            topspacing = 5 + (12 + 5)*i
            self.draw.text((10, topspacing), line, fill = colour, font = self.infofont)
        
        
        if self.verbose :
            print "I've written some info on the image."
1146696
def write_data(self, write_finished_cb):
        """"""
        self._write_finished_cb = write_finished_cb
        data = bytearray()
        for led in self.leds:
            # In order to fit all the LEDs in one radio packet RGB565 is used
            # to compress the colors. The calculations below converts 3 bytes
            # RGB into 2 bytes RGB565. Then shifts the value of each color to
            # LSB, applies the intensity and shifts them back for correct
            # alignment on 2 bytes.
            R5 = ((int)((((int(led.r) & 0xFF) * 249 + 1014) >> 11) & 0x1F) *
                  led.intensity / 100)
            G6 = ((int)((((int(led.g) & 0xFF) * 253 + 505) >> 10) & 0x3F) *
                  led.intensity / 100)
            B5 = ((int)((((int(led.b) & 0xFF) * 249 + 1014) >> 11) & 0x1F) *
                  led.intensity / 100)
            tmp = (int(R5) << 11) | (int(G6) << 5) | (int(B5) << 0)
            data += bytearray((tmp >> 8, tmp & 0xFF))
        self.mem_handler.write(self, 0x00, data, flush_queue=True)
235792
def _enforceDataType(self, data):
        
        qColor = QtGui.QColor(data)    # TODO: store a RGB string?
        if not qColor.isValid():
            raise ValueError("Invalid color specification: {!r}".format(data))
        return qColor
866340
def write(self, s, level=0, color=None):
        """"""
        if level > self.level:
            return
        if self.timestamps:
            timestamp = time.strftime(u'%H:%M:%S ')
        else:
            timestamp = u''
        with lock:
            if self.context:
                self.stream.write(u'%s%s> ' % (timestamp, self.context))
            elif self.context is None:
                self.stream.write(u'%s%s> ' % (timestamp, get_threadname()))
            self.stream.write(u'%s' % s, color=color)
            try:
                text_type = unicode
            except NameError:
                text_type = str
            self.stream.write(text_type(os.linesep))
            self.stream.flush()
648017
def write(self, text: str):
        
        # Default color is NORMAL.
        last_color = (self._DARK_CODE, 0)
        # We use splitlines with keepends in order to keep the line breaks.
        # Then we split by using the console width.
        original_lines = text.splitlines(True)
        lines = self._split_lines(original_lines) if self._width_limit else original_lines

        # Print the new width-formatted lines.
        for line in lines:
            # Print indents only at line beginnings.
            if not self._in_line:
                self._writer.write(' ' * self.indents_sum)
            # Remove colors if needed.
            if not self._colors:
                for color_code in self._ANSI_REGEXP.findall(line):
                    line = line.replace(self._ANSI_COLOR_CODE % (color_code[0], int(color_code[1])), '')
            elif not self._ANSI_REGEXP.match(line):
                # Check if the line starts with a color. If not, we apply the color from the last line.
                line = self._ANSI_COLOR_CODE % (last_color[0], int(last_color[1])) + line
            # Print the final line.
            self._writer.write(line)
            # Update the in_line status.
            self._in_line = not line.endswith(self.LINE_SEP)
            # Update the last color used.
            if self._colors:
                last_color = self._ANSI_REGEXP.findall(line)[-1]

        # Update last position (if there was no line break in the end).
        if len(lines) > 0:
            last_line = lines[-1]
            if not last_line.endswith(self.LINE_SEP):
                # Strip the colors to figure out the real number of characters in the line.
                if self._colors:
                    for color_code in self._ANSI_REGEXP.findall(last_line):
                        last_line = last_line.replace(self._ANSI_COLOR_CODE % (color_code[0], int(color_code[1])), '')
                self._last_position += len(last_line)
            else:
                self._last_position = 0
                self._is_first_line = False
        else:
            self._last_position = 0

        # Reset colors for the next print.
        if self._colors and not text.endswith(self.NORMAL):
            self._writer.write(self.NORMAL)
373629
def write(self, text, color):
        
        color = self._colors[color]
        self.stream.write('\x1b[{}m{}\x1b[0m'.format(color, text))
1304334
def format(filename=nil, line=nil)
      out = ""
      if filename
        out = Util::OS.windows? ? filename.gsub('/', '\\') : filename
        if line
          out += ":#{line}:"
        end
      end
      paint(:magenta, out)
    end
80183
def WriteProtoFile(self, printer):
        """"""
        self.Validate()
        extended_descriptor.WriteMessagesFile(
            self.__file_descriptor, self.__package, self.__client_info.version,
            printer)
539479
private function _writeColourScheme($objWriter)
	{
		foreach(self::$_colourScheme as $colourName => $colourValue) {
			$objWriter->startElement('a:'.$colourName);

				$objWriter->startElement('a:srgbClr');
					$objWriter->writeAttribute('val', $colourValue);
				$objWriter->endElement();

			$objWriter->endElement();
		}
						
	}
1302201
def write_color(self, text, attr=None):
        '''
        '''
        log(u'write_color("%s", %s)' % (text, attr))
        chunks = self.terminal_escape.split(text)
        log(u'chunks=%s' % repr(chunks))
        bg = self.savebg
        n = 0 # count the characters we actually write, omitting the escapes
        if attr is None:#use attribute from initial console
            attr = self.attr
        try:
            fg = self.trtable[(0x000f&attr)]
            bg = self.trtable[(0x00f0&attr)>>4]
        except TypeError:
            fg = attr
            
        for chunk in chunks:
            m = self.escape_parts.match(chunk)
            if m:
                log(m.group(1))
                attr = ansicolor.get(m.group(1), self.attr)
            n += len(chunk)
            System.Console.ForegroundColor = fg
            System.Console.BackgroundColor = bg
            System.Console.Write(chunk)
        return n
777344
function writeLSD() {

    // logical screen size
    WriteShort(width);
    WriteShort(height);
    // packed fields
    out.writeByte((0x80 | // 1 : global color table flag = 1 (gct used)
      0x70 | // 2-4 : color resolution = 7
      0x00 | // 5 : gct sort flag = 0
      palSize)); // 6-8 : gct size

    out.writeByte(0); // background color index
    out.writeByte(0); // pixel aspect ratio - assume 1:1
  }
1293565
def color(colors, export_type, output_file=None):
    """"""
    all_colors = flatten_colors(colors)

    template_name = get_export_type(export_type)
    template_file = os.path.join(MODULE_DIR, "templates", template_name)
    output_file = output_file or os.path.join(CACHE_DIR, template_name)

    if os.path.isfile(template_file):
        template(all_colors, template_file, output_file)
        logging.info("Exported %s.", export_type)
    else:
        logging.warning("Template '%s' doesn't exist.", export_type)
1115590
def write_color(writer, name, value) #:nodoc:
      attributes = [[name, value]]

      writer.empty_tag('color', attributes)
    end
676770
def write(self):
        """"""
        outfn = self.create_outfilepath(self.fn, self.outsuffix)
        command = ['qvality']
        command.extend(self.qvalityoptions)
        command.extend([self.scores['target']['fn'], self.scores['decoy']['fn'],
                        '-o', outfn])
        subprocess.call(command)
78268
def _colorbar_format(minval, maxval):
    """"""
    if not (np.isfinite(minval) and np.isfinite(maxval)):
        return str(maxval)
    else:
        return '%.{}f'.format(_digits(minval, maxval))
397081
def terminal_sexy_to_wal(data):
    """"""
    data["colors"] = {}
    data["special"] = {
        "foreground": data["foreground"],
        "background": data["background"],
        "cursor": data["color"][9]
    }

    for i, color in enumerate(data["color"]):
        data["colors"]["color%s" % i] = color

    return data