Skip to content

Commit 302d5d9

Browse files
committed
Add predefined constants for simple colors to DeviceRgb
DEVSIX-1527
1 parent c0a9b6e commit 302d5d9

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

kernel/src/main/java/com/itextpdf/kernel/color/ColorConstants.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ public class ColorConstants {
99
/**
1010
* Predefined black DeviceRgb color
1111
*/
12-
public static final Color BLACK = new DeviceRgb(0, 0, 0);
12+
public static final Color BLACK = DeviceRgb.BLACK;
1313
/**
1414
* Predefined blue DeviceRgb color
1515
*/
16-
public static final Color BLUE = new DeviceRgb(0, 0, 255);
16+
public static final Color BLUE = DeviceRgb.BLUE;
1717
/**
1818
* Predefined cyan DeviceRgb color
1919
*/
@@ -29,7 +29,7 @@ public class ColorConstants {
2929
/**
3030
* Predefined green DeviceRgb color
3131
*/
32-
public static final Color GREEN = new DeviceRgb(0, 255, 0);
32+
public static final Color GREEN = DeviceRgb.GREEN;
3333
/**
3434
* Predefined light gray DeviceRgb color
3535
*/
@@ -49,11 +49,11 @@ public class ColorConstants {
4949
/**
5050
* Predefined red DeviceRgb color
5151
*/
52-
public static final Color RED = new DeviceRgb(255, 0, 0);
52+
public static final Color RED = DeviceRgb.RED;
5353
/**
5454
* Predefined white DeviceRgb color
5555
*/
56-
public static final Color WHITE = new DeviceRgb(255, 255, 255);
56+
public static final Color WHITE = DeviceRgb.WHITE;
5757
/**
5858
* Predefined yellow DeviceRgb color
5959
*/

kernel/src/main/java/com/itextpdf/kernel/color/DeviceRgb.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,30 @@ This file is part of the iText (R) project.
5252
* Color space to specify colors according to RGB color model.
5353
*/
5454
public class DeviceRgb extends Color {
55+
/**
56+
* Predefined black DeviceRgb color
57+
*/
58+
public static final Color BLACK = new DeviceRgb(0, 0, 0);
59+
60+
/**
61+
* Predefined white DeviceRgb color
62+
*/
63+
public static final Color WHITE = new DeviceRgb(255, 255, 255);
64+
65+
/**
66+
* Predefined red DeviceRgb color
67+
*/
68+
public static final Color RED = new DeviceRgb(255, 0, 0);
69+
70+
/**
71+
* Predefined green DeviceRgb color
72+
*/
73+
public static final Color GREEN = new DeviceRgb(0, 255, 0);
74+
75+
/**
76+
* Predefined blue DeviceRgb color
77+
*/
78+
public static final Color BLUE = new DeviceRgb(0, 0, 255);
5579

5680
private static final long serialVersionUID = 7172400358137528030L;
5781

0 commit comments

Comments
 (0)