88 lines
2.2 KiB
Java
88 lines
2.2 KiB
Java
import java.awt.*;
|
|
|
|
/**
|
|
* Color themes for the chessboard and pieces
|
|
*/
|
|
public enum Theme {
|
|
|
|
CLASSIC(
|
|
Color.WHITE, Color.BLACK, Color.BLACK, Color.WHITE, Color.WHITE, Color.LIGHT_GRAY
|
|
),
|
|
GREEN(
|
|
Color.decode("#f9f9f9"), Color.decode("#333333"), Color.decode("#1E2615"), Color.decode("#ffffff"),
|
|
Color.decode("#ebecd0"), Color.decode("#779556")
|
|
),
|
|
YELLOW(
|
|
Color.decode("#e1d1b8"), Color.decode("#4f2d20"), Color.decode("#4f2d20"), Color.decode("#ffffff"),
|
|
Color.decode("#feefe0"), Color.decode("#e7ba83")
|
|
),
|
|
RED(
|
|
Color.decode("#ffffff"), Color.decode("#520D0D"), Color.decode("#520D0D"), Color.decode("#ffffff"),
|
|
Color.decode("#FF8A80"), Color.decode("#e2514c")
|
|
);
|
|
|
|
/**
|
|
* Current active theme
|
|
*/
|
|
public static Theme activeTheme = Theme.CLASSIC;
|
|
|
|
/**
|
|
* Set new active theme
|
|
* @param theme selected theme
|
|
*/
|
|
public static void setTheme(Theme theme) {
|
|
activeTheme = theme;
|
|
Chessboard.setTheme(theme);
|
|
PieceColor.setTheme(theme);
|
|
}
|
|
|
|
/**
|
|
* White piece's fill color
|
|
*/
|
|
Color whiteFill;
|
|
|
|
/**
|
|
* White piece's border color
|
|
*/
|
|
Color whiteBorder;
|
|
|
|
/**
|
|
* Black piece's fill color
|
|
*/
|
|
Color blackFill;
|
|
|
|
/**
|
|
* Black piece's border color
|
|
*/
|
|
Color blackBorder;
|
|
|
|
/**
|
|
* Chessboard light square's color
|
|
*/
|
|
Color lightSquare;
|
|
|
|
/**
|
|
* Chessboard dark square's color
|
|
*/
|
|
Color darkSquare;
|
|
|
|
/**
|
|
* Constructor of the theme
|
|
* @param whiteFill white piece's fill
|
|
* @param whiteBorder white piece's border
|
|
* @param blackFill black piece's fill
|
|
* @param blackBorder black piece's border
|
|
* @param lightSquare light square's color
|
|
* @param darkSquare dark square's color
|
|
*/
|
|
Theme(Color whiteFill, Color whiteBorder, Color blackFill, Color blackBorder, Color lightSquare, Color darkSquare) {
|
|
this.whiteFill = whiteFill;
|
|
this.whiteBorder = whiteBorder;
|
|
this.blackFill = blackFill;
|
|
this.blackBorder = blackBorder;
|
|
this.lightSquare = lightSquare;
|
|
this.darkSquare = darkSquare;
|
|
}
|
|
|
|
}
|