[back to index]

Library Reference (v 0.9.0)

Col

So many colors!
BLACK GREY WHITE RED PINK DARKBROWN BROWN ORANGE YELLOW DARKGREEN GREEN LIGHTGREEN NIGHTBLUE DARKBLUE BLUE LIGHTBLUE MAGENTA TRANSPARENT

Col.rgb(red [0-255], green [0-255], blue [0-255]):Int
Converts a color with given red, green, and blue values (between 0-255 each) to a single hex number.
Col.hsl(hue [0-360], saturation [0-1.0], lightness [0-1.0] ):Int
Converts a color with given hue (0-360), saturation [0-1], and lightness [0-1] values to a single hex number.
Col.getred(col):Int
Returns the red component of a hex color (Between 0-255 inclusive).
Col.getgreen(col):Int
Returns the green component of a hex color (Between 0-255 inclusive).
Col.getblue(col):Int
Returns the blue component of a hex color (Between 0-255 inclusive).
Col.gethue(col):Int
Returns the hue (0-360) value of a color.
Col.getsaturation(col):Float
Returns the saturation (0.0-1.0) value of a color.
Col.getlightness(col):Int
Returns the lightness (0.0-1.0) value of a color.
Col.shiftred(col, amount):Int
Returns a colour with the red component (0-255) adjusted.
Col.shiftgreen(col, amount):Int
Returns a colour with the green component (0-255) adjusted.
Col.shiftblue(col, amount):Int
Returns a colour with the blue component (0-255) adjusted.
Col.multiplysaturation(col, amount):Int
Returns a colour with the saturation (0-1.0) multiplied.
import haxegon.*;

class Main { 
 function update() {
   //Multiply Col.GREEN by 50%, and clear the screen to that colour
   //(making it half as saturated)
  Gfx.clearscreen(Col.multiplysaturation(Col.GREEN, 0.5));
 }
}
Col.multiplylightness(col, amount):Int
Returns a colour with the lightness (0-1.0) multiplied.
import haxegon.*;

class Main { 
 function update() {
   //Multiply Col.RED by 150%, and clear the screen to that colour
   //(making it one and a half times brighter)
  Gfx.clearscreen(Col.multiplylightness(Col.RED, 1.5));
 }
}