def colorString()

in vmassist/linux/vmassist.py [0:0]


def colorString(strIn, redVal="dead", greenVal="active", yellowVal="inactive"):
  # force these into strs
  strIn = str(strIn)
  redVal = str(redVal)
  greenVal = str(greenVal)
  yellowVal = str(yellowVal)
  # ordered so that errors come first, then warnings and eventually "I guess it's OK"
  if redVal.lower() in strIn.lower():
    return cRed(strIn)
  elif yellowVal.lower() in strIn.lower():
    return cYellow(strIn)
  elif greenVal.lower() in strIn.lower():
    return cGreen(strIn)
  else:
    return cBlack(strIn)