package com.danitheskunk.skunkworks.gfx;

/**
 * 32bit RGBA Color
 */
public final class Color {
	/**
	 * #000000
	 */
	public final static Color BLACK = new Color(0, 0, 0);
	/**
	 * #0000FF
	 */
	public final static Color BLUE = new Color(0, 0, 255);
	/**
	 * #00FFFF
	 */
	public final static Color CYAN = new Color(0, 255, 255);
	/**
	 * #404040
	 */
	public final static Color DARK_GRAY = new Color(64, 64, 64);
	/**
	 * #808080
	 */
	public final static Color GRAY = new Color(128, 128, 128);
	/**
	 * #00FF00
	 */
	public final static Color GREEN = new Color(0, 255, 0);
	/**
	 * #C0C0C0
	 */
	public final static Color LIGHT_GRAY = new Color(192, 192, 192);
	/**
	 * #FF00FF
	 */
	public final static Color MAGENTA = new Color(255, 0, 255);
	/**
	 * #FF0000
	 */
	public final static Color RED = new Color(255, 0, 0);
	/**
	 * #000000 (with alpha=0)
	 */
	public final static Color TRANS_BLACK = new Color(0, 0, 0, 0);
	/**
	 * #FFFFFF
	 */
	public final static Color WHITE = new Color(255, 255, 255);
	/**
	 * #FFFF00
	 */
	public final static Color YELLOW = new Color(255, 255, 0);
	private final int r, g, b, a;


	/**
	 * Creates a color (with alpha=255)
	 *
	 * @param r the red component 0-255
	 * @param g the green component 0-255
	 * @param b the blue component 0-255
	 */
	public Color(int r, int g, int b) {
		this.r = r;
		this.g = g;
		this.b = b;
		a = 0xff;
	}

	/**
	 * Creates a color
	 *
	 * @param r the red component 0-255
	 * @param g the green component 0-255
	 * @param b the blue component 0-255
	 * @param a the alpha component 0-255
	 */
	public Color(int r, int g, int b, int a) {
		this.r = r;
		this.g = g;
		this.b = b;
		this.a = a;
	}

	/**
	 * Returns the alpha component 0-255
	 *
	 * @return the alpha component 0-255
	 */
	public int getA() {
		return a;
	}

	/**
	 * Returns the blue component 0-255
	 *
	 * @return the blue component 0-255
	 */
	public int getB() {
		return b;
	}

	/**
	 * Return the green component 0-255
	 *
	 * @return the green component 0-255
	 */
	public int getG() {
		return g;
	}

	/**
	 * Return the red component 0-255
	 *
	 * @return the red component 0-255
	 */
	public int getR() {
		return r;
	}

	@Override
	public String toString() {
		return String.format("#%02X%02X%02X%02X", r, g, b, a);
	}
}
