Package io.github.dornol.excelkit.excel
Class ExcelColor
java.lang.Object
io.github.dornol.excelkit.excel.ExcelColor
Represents an RGB color for Excel header backgrounds and cell styling.
Provides commonly used color presets as static constants, and supports
custom RGB values via of(int, int, int).
// Using a preset
ExcelWriter.create().headerColor(ExcelColor.STEEL_BLUE);
// Using a custom RGB color
ExcelWriter.create().headerColor(ExcelColor.of(180, 200, 220));
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ExcelColorBlack (0, 0, 0).static final ExcelColorBlue (0, 0, 255).static final ExcelColorCoral (255, 127, 80).static final ExcelColorDark gray (64, 64, 64).static final ExcelColorForest green (34, 139, 34).static final ExcelColorGold (255, 215, 0).static final ExcelColorGray (128, 128, 128).static final ExcelColorGreen (0, 128, 0).static final ExcelColorLight blue for backgrounds.static final ExcelColorLight gray (217, 217, 217).static final ExcelColorLight green for backgrounds.static final ExcelColorLight orange for backgrounds.static final ExcelColorLight purple for backgrounds.static final ExcelColorLight red for backgrounds.static final ExcelColorLight yellow for backgrounds.static final ExcelColorNavy (0, 0, 128).static final ExcelColorOrange (255, 165, 0).static final ExcelColorPink (255, 192, 203).static final ExcelColorPurple (128, 0, 128).static final ExcelColorRed (255, 0, 0).static final ExcelColorSteel blue (70, 130, 180).static final ExcelColorTeal (0, 128, 128).static final ExcelColorWhite (255, 255, 255).static final ExcelColorYellow (255, 255, 0). -
Method Summary
Modifier and TypeMethodDescriptionintgetB()Returns the blue component (0-255).intgetG()Returns the green component (0-255).intgetR()Returns the red component (0-255).static ExcelColorof(int r, int g, int b) Creates a custom color from RGB values.int[]toRgb()Returns the color as an RGB array.
-
Field Details
-
WHITE
White (255, 255, 255). -
BLACK
Black (0, 0, 0). -
LIGHT_GRAY
Light gray (217, 217, 217). -
GRAY
Gray (128, 128, 128). -
DARK_GRAY
Dark gray (64, 64, 64). -
RED
Red (255, 0, 0). -
GREEN
Green (0, 128, 0). -
BLUE
Blue (0, 0, 255). -
YELLOW
Yellow (255, 255, 0). -
ORANGE
Orange (255, 165, 0). -
LIGHT_RED
Light red for backgrounds. -
LIGHT_GREEN
Light green for backgrounds. -
LIGHT_BLUE
Light blue for backgrounds. -
LIGHT_YELLOW
Light yellow for backgrounds. -
LIGHT_ORANGE
Light orange for backgrounds. -
LIGHT_PURPLE
Light purple for backgrounds. -
PURPLE
Purple (128, 0, 128). -
PINK
Pink (255, 192, 203). -
TEAL
Teal (0, 128, 128). -
NAVY
Navy (0, 0, 128). -
CORAL
Coral (255, 127, 80). -
STEEL_BLUE
Steel blue (70, 130, 180). -
FOREST_GREEN
Forest green (34, 139, 34). -
GOLD
Gold (255, 215, 0).
-
-
Method Details
-
of
Creates a custom color from RGB values.- Parameters:
r- Red component (0–255)g- Green component (0–255)b- Blue component (0–255)- Returns:
- a new ExcelColor instance
-
getR
public int getR()Returns the red component (0-255).- Returns:
- red value
-
getG
public int getG()Returns the green component (0-255).- Returns:
- green value
-
getB
public int getB()Returns the blue component (0-255).- Returns:
- blue value
-
toRgb
public int[] toRgb()Returns the color as an RGB array.- Returns:
{r, g, b}array
-