Get the type of this context as an optionally coloured string.

        @param add_colour If True, ANSI colour codes will be added.
        @return A string describing the kind of execution context this is.
337671
def kind_as_string(self, add_colour=True):
        '''

        '''
        with self._mutex:
            if self.kind == self.PERIODIC:
                result = 'Periodic', ['reset']
            elif self.kind == self.EVENT_DRIVEN:
                result = 'Event-driven', ['reset']
            elif self.kind == self.OTHER:
                result = 'Other', ['reset']
        if add_colour:
            return utils.build_attr_string(result[1], supported=add_colour) + \
                    result[0] + utils.build_attr_string('reset', supported=add_colour)
        else:
            return result[0]
1313393
def get_color_for_language(lang)
      color_lang = @colors[lang]
      color = color_lang['color']
      if color_lang.nil? || color.nil?
        return StringUtility.random_color_six
      else
        return color
      end
    end
1152415
def color_string(color, string):
    
    if not color_available:
        return string

    return color + string + colorama.Fore.RESET
656072
public static function getColoredString($string, $foreground_color = '', $background_color = '')
    {
        $colored_string = '';

        // Check if given foreground color exists
        if (isset(static::$foreground_colors[$foreground_color])) {
            $colored_string .= "\033[".static::$foreground_colors[$foreground_color].'m';
        }

        // Check if given background color exists
        if (isset(static::$background_colors[$background_color])) {
            $colored_string .= "\033[".static::$background_colors[$background_color].'m';
        }

        if ($colored_string) {
            // Add string and end coloring
            $colored_string .= $string."\033[0m";
        } else {
            $colored_string = $string;
        }

        return $colored_string;
    }
233769
def :
    
    # All argument types must be str.
    rtext = [str(f) for f in text]

    return COLORIZE_FORMAT.format(
        _to_int(bg), _to_int(base), _to_int(fg), ''.join(rtext)
    )
457788
def enum_type(self):
        
        if not hasattr(self, '_enum_type'):
            assert self.kind == CursorKind.ENUM_DECL
            self._enum_type = conf.lib.clang_getEnumDeclIntegerType(self)

        return self._enum_type
455964
private String colorType(SchemaConcept schemaConcept) {
        if(colorize) {
            return ANSI.color(label(schemaConcept.label()), ANSI.PURPLE);
        } else {
            return label(schemaConcept.label());
        }
    }
1041983
def stringc(text, color):
    
    if has_colors:
        text = str(text)

        return "\033["+codeCodes[color]+"m"+text+"\033[0m"
    else:
        return text
148708
public int color(Context ctx) {
        if (mColorInt == 0 && mColorRes != -1) {
            mColorInt = ContextCompat.getColor(ctx, mColorRes);
        }
        return mColorInt;
    }
1281033
public static int getColorAttr(Context ctx, @AttrRes int colorAttrId){
        int[] attrs = new int[] { colorAttrId /* index 0 */};
        TypedArray ta = ctx.obtainStyledAttributes(attrs);
        int colorFromTheme = ta.getColor(0, 0);
        ta.recycle();
        return colorFromTheme;
    }
504278
private TwoColors getCheckBoxBulletColors(CommonControlState type) {
        switch (type) {

        case DISABLED:
        case DISABLED_SELECTED:
            return buttonbulletDisabled;

        case ENABLED:
        case PRESSED:
        case SELECTED:
        case PRESSED_SELECTED:
            return buttonBulletEnabled;
        }

        return null;
    }
313351
def get_operation_type(self, operation_name):
        # type: (Optional[str]) -> Optional[str]
        
        operations_map = self.operations_map
        if not operation_name and len(operations_map) == 1:
            return next(iter(operations_map.values()))
        return operations_map.get(operation_name)
322899
def choose_colour(self, title="Select Colour", **kwargs):
        
        return_data = self._run_zenity(title, ["--color-selection"], kwargs)
        if return_data.successful:
            converted_colour = ColourData.from_zenity_tuple_str(return_data.data)
            return DialogData(return_data.return_code, converted_colour)
        else:
            return DialogData(return_data.return_code, None)
1207784
def code2color(color_string):
    """"""

    color_tuple = ast.literal_eval(color_string)
    color_tuple_int = map(lambda x: int(x * 255.0), color_tuple)

    return wx.Colour(*color_tuple_int)
756476
def hex_color(a)
      case a
      when FIXNUM_COL
        Java::Monkstone::ColorUtil.colorLong(a)
      when STRING_COL
        return Java::Monkstone::ColorUtil.colorString(a) if a =~ /#\h+/
        raise StandardError, 'Dodgy Hexstring'
      when FLOAT_COL
        Java::Monkstone::ColorUtil.colorDouble(a)
      else
        raise StandardError, 'Dodgy Color Conversion'
      end
    end
1147263
public static int color(ColorHolder colorHolder, Context ctx, @AttrRes int colorStyle, @ColorRes int colorDefault) {
        if (colorHolder == null) {
            return UIUtils.getThemeColorFromAttrOrRes(ctx, colorStyle, colorDefault);
        } else {
            return colorHolder.color(ctx, colorStyle, colorDefault);
        }
    }
195441
private String getValueTypeDotString() {
        PlanNodeType pnt = getPlanNodeType();
        if (isInline()) {
            return "fontcolor=\"white\" style=\"filled\" fillcolor=\"red\"";
        }
        if (pnt == PlanNodeType.SEND || pnt == PlanNodeType.RECEIVE || pnt == PlanNodeType.MERGERECEIVE) {
            return "fontcolor=\"white\" style=\"filled\" fillcolor=\"black\"";
        }
        return "";
    }