         @b = 0 unless @b?
         @a = 255 unless @a?
         
-        @r = Elyssa.Math.clamp(@r, 0, colorMax)
-        @g = Elyssa.Math.clamp(@g, 0, colorMax)
-        @b = Elyssa.Math.clamp(@b, 0, colorMax)
-        @a = Elyssa.Math.clamp(@a, 0, colorMax)
+        @r = Math.clamp(@r, 0, colorMax)
+        @g = Math.clamp(@g, 0, colorMax)
+        @b = Math.clamp(@b, 0, colorMax)
+        @a = Math.clamp(@a, 0, colorMax)
     
     # Converts the color class into a valid CSS string color
     #

do (window = @, Elyssa = @Elyssa or= {}) ->
  'use strict'
  
  # Color class
  # This class allows to modifiy R, G, B and alpha value as well
  # It also provides static functions 
  class Elyssa.Color
    
    colorMax = 255
    

    # @param {Number} The percentage (0.0 - 1.0) the color will be darkened
    # @return {Object} The color object
    darken: (factor) ->
      factor = Math.clamp(factor)
      
      delta = Math.round(colorMax * factor)
      @r -= delta
      @g -= delta
      @b -= delta
      
      @r = Math.clamp(@r, 0, colorMax)
      @g = Math.clamp(@g, 0, colorMax)
      @b = Math.clamp(@b, 0, colorMax)
      
      @
    
    fadeIn: (factor) -> 
      factor = Math.clamp(factor)
      
      delta = Math.round(colorMax * factor)
      @a += delta
      
      @a = Math.clamp(@a, 0, colorMax)
      
      @
      
    fadeOut: (factor) -> 
      factor = Math.clamp(factor)
      
      delta = Math.round(colorMax * factor)
      @a -= delta
      
      @a = Math.clamp(@a, 0, colorMax)
      
      @
    
