text: '''
  Collection of utility classes used throughout the application
  '''
  import math
  
  '''
  Converts an RGB color code to a hexadecimal
  color.
  '''
  def to_hex(color):
      return "#{:02x}{:02x}{:02x}".format(int(color[0]), int(color[1]), int(color[2]))
  
  def EnhanceColor(normalized):
      if normalized > 0.04045:
          return math.pow((normalized + 0.055) / (1.0 + 0.055), 2.4)
      else:
          return normalized / 12.92
  
  '''
  Converts from an RGB value to an HSL value
  '''
  def rgb_to_xy(r, g, b):
      rNorm = r / 255.0
      gNorm = g / 255.0
      bNorm = b / 255.0
  
      rFinal = EnhanceColor(rNorm)
      gFinal = EnhanceColor(gNorm)
      bFinal = EnhanceColor(bNorm)
  
      X = rFinal * 0.649926 + gFinal * 0.103455 + bFinal * 0.197109
      Y = rFinal * 0.234327 + gFinal * 0.743075 + bFinal * 0.022598
      Z = rFinal * 0.000000 + gFinal * 0.053077 + bFinal * 1.035763
  
      if X + Y + Z == 0:
          return (0, 0)
      else:
          xFinal = X / (X + Y + Z)
          yFinal = Y / (X + Y + Z)
  
          return (xFinal, yFinal)