Ejemplo n.º 1
0
def colorText(text, color):
	"""Applies the color (string or int) to text and returns the resulting string."""
	if text is not None and color is not None:
		if isinstance(color, types.StringTypes):
			color = ColorUtil.keyToType(color)
		if color >= 0:
			return localText.changeTextColor(text, color)
	return text
Ejemplo n.º 2
0
	def getColor(self, *args):
		"""Returns the value as a color type (int) if this is a color or string option,
		the actual value if an int, or -1 otherwise.
		"""
		if self.isColor() or self.isString():
			return ColorUtil.keyToType(self.getValue(*args))
		elif self.isInt():
			return self.getValue(*args)
		return -1
Ejemplo n.º 3
0
	def getColor(self, *args):
		"""Returns the value as a color type (int) if this is a color or string option,
		the actual value if an int, or -1 otherwise.
		"""
		if self.isColor() or self.isString():
			return ColorUtil.keyToType(self.getValue(*args))
		elif self.isInt():
			return self.getValue(*args)
		return -1
def colorText(text, color):
    """
	Applies the color (string or int) to text and returns the resulting string.
	"""
    if text is not None and color is not None:
        if isinstance(color, types.StringTypes):
            color = ColorUtil.keyToType(color)
        if color >= 0:
            return localText.changeTextColor(text, color)
    return text