Underlines the text.

        :param color: underline color.
969048
def set_as_underlined(self, color=Qt.blue):
        
        self.format.setUnderlineStyle(
            QTextCharFormat.SingleUnderline)
        self.format.setUnderlineColor(color)
897796
def set_text_color(self, r,g=-1,b=-1):
        ""
        if((r==0 and g==0 and b==0) or g==-1):
            self.text_color=sprintf('%.3f g',r/255.0)
        else:
            self.text_color=sprintf('%.3f %.3f %.3f rg',r/255.0,g/255.0,b/255.0)
        self.color_flag=(self.fill_color!=self.text_color)
1129576
function (text, color, x, y, width) {
                        ctx.fillStyle = color;
                        var metric = ctx.measureText(text);
                        if (metric.width > width) {
                            while (text !== "") {
                                metric = ctx.measureText(text + "...");
                                if (metric.width <= width) {
                                    text += "...";
                                    break;
                                }
                                text = text.substr(0, text.length - 1);
                            }
                        }
                        ctx.fillText(text, x, y, width);
                    }
373629
def write(self, text, color):
        
        color = self._colors[color]
        self.stream.write('\x1b[{}m{}\x1b[0m'.format(color, text))
1361999
public void setLineColor(@ColorInt int color) {
    jsonObject.addProperty(LineOptions.PROPERTY_LINE_COLOR, ColorUtils.colorToRgbaString(color));
  }
385508
def underline_color_attribute(styles={})
      return nil if styles.nil?
      value = styles[:underline_color]
      return nil unless value && value.is_a?(UIColor)
      value
    end
731632
def colorize(target, color, use_escape=True):
    ''' '''
    def escape(code):
        ''' Escape character '''
        return '\001%s\002' % code
    if color == 'purple':
        color_code = '\033[95m'
    elif color == 'cyan':
        color_code = '\033[96m'
    elif color == 'darkcyan':
        color_code = '\033[36m'
    elif color == 'blue':
        color_code = '\033[93m'
    elif color == 'green':
        color_code = '\033[92m'
    elif color == 'yellow':
        color_code = '\033[93m'
    elif color == 'red':
        color_code = '\033[91m'
    elif color == 'white':
        color_code = '\033[37m'
    elif color == 'bold':
        color_code = '\033[1m'
    elif color == 'underline':
        color_code = '\033[4m'
    else:
        color_code = ''
    if use_escape:
        return escape(color_code) + target + escape('\033[0m')
    else:
        return color_code + target + '\033[m'
1075036
def color(self, color):
        
        if color is None:
            color = 0xFFFFFFFF

        idc.SetColor(self.ea, idc.CIC_FUNC, color)
646623
def setCenterLineColor(self, color):
        
        palette = self.palette()
        palette.setColor(palette.GridCenterline, QColor(color))
1326912
public void setTextColor(final Color COLOR) {
        if (null == textColor) {
            _textColor = COLOR;
            fireSectionEvent(UPDATE_EVENT);
        } else {
            textColor.set(COLOR);
        }
    }
1267157
def color(text, color=None, background=None, light=False, enabled="auto"):
    
    colors = {"black": 30, "red": 31, "green": 32, "yellow": 33,
              "blue": 34, "magenta": 35, "cyan": 36, "white": 37}
    # Nothing do do if coloring disabled
    if enabled == "auto":
        enabled = Coloring().enabled()
    if not enabled:
        return text
    # Prepare colors (strip 'light' if present in color)
    if color and color.startswith("light"):
        light = True
        color = color[5:]
    color = color and ";{0}".format(colors[color]) or ""
    background = background and ";{0}".format(colors[background] + 10) or ""
    light = light and 1 or 0
    # Starting and finishing sequence
    start = "\033[{0}{1}{2}m".format(light, color, background)
    finish = "\033[1;m"
    return "".join([start, text, finish])
1333010
def line(self, text, style=None, verbosity=None):
        
        if style:
            styled = "<%s>%s</>" % (style, text)
        else:
            styled = text

        self._io.write_line(styled, verbosity)
370018
def stylize(txt, bold=False, underline=False):
    

    setting = ''
    setting += _SET_BOLD if bold is True else ''
    setting += _SET_UNDERLINE if underline is True else ''
    return setting + str(txt) + _STYLE_RESET
1152076
def set_as_error(self, color=Qt.red):
        
        self.format.setUnderlineStyle(
            QTextCharFormat.WaveUnderline)
        self.format.setUnderlineColor(color)
848931
def cprint(text, color=None, on_color=None, attrs=None, **kwargs):
    

    print((colored(text, color, on_color, attrs)), **kwargs)
287135
def underline(text):
    ''''''

    text += "\n"
    for i in range(len(text)-1):
        text += "="
    text += "\n"
    return text
119075
def _colourise(text: str, colour: str) -> str:
    
    if COLOUR:
        text = style(text, fg=colour, bold=True)
    return text