About Color

SwinGame allows you to create your own custom colors using a variety of methods, this will teach you the basics of color, and color in SwinGame.


$('#colorpickerHolder').ColorPicker({flat: true});


SwinGame can create custom colors in a range of different formats, including RGB, RGBA, and HSB. SwinGame it also has some predefined colors available to you, colors like white, black, red, green and so on. But before you use these colors you have to load them using LoadDefaultColors.

HSB Color

HSB stands for Hue, Saturation, Brightness. The HSB color model uses the hue, saturation, and brightness to determine what the color looks like.

The hue of a color is the shade of the color, the hue determines the actual color. 

The saturation is the intensity of the color a higher saturation means more color and less white, if the saturation is 0 then the hue is irrelevant because there is no color. 

The brightness of the color refers to how light the color is. If the brightness is 0 then the color will be black however if the brightness is full then the color will be white.

To create an HSB color you can use SwinGame's HSBColor function, HSB colors in SwinGame do not support transparency.

RGB Color

RGB stands for Red, Green, Blue. The RGB color system is an additive model, the colors are added together to form different colors. Therefore if you combine red and green the resulting color will be yellow, similarly if you combine all three colors you get white.

To create an RGB color you can use SwinGame's RGBColor function, the values passed into the RGBColor function represent the intensity of the primary colors.

Color Transparency

There is a variation of RGB color called RGBA color, this includes an alpha field that allows you to specify how transparent you want the color to be. To create an RGBA color you can use SwinGame's RGBAColor function.

If the alpha value of a color is full it means the color is completely opaque, while an alpha value of 0 means that the color is completely transparent. If the value is in the middle it means that it is half transparent.

Colors returned from SwinGame's HSBColor and RGBColor are always completely opaque.