Color

Overview

Color is a class in Aspose.Pdf FOSS for Java.

Represents a color value in one of several color spaces (RGB, Grayscale, CMYK).

Properties

NameTypeAccessDescription
blackColorReadReturns the predefined black color.
whiteColorReadReturns the predefined white color.
redColorReadReturns the predefined red color.
greenColorReadReturns the predefined green color.
blueColorReadReturns the predefined blue color.
yellowColorReadReturns the predefined yellow color.
grayColorReadReturns the predefined gray color.
lightGrayColorReadReturns the predefined light gray color.
transparentColorReadReturns the predefined transparent color.
alphadoubleReadReturns the alpha (opacity) component of this color.
colorSpaceColorSpaceReadReturns the color space of this color.
componentsdouble[]ReadReturns a copy of the component values.
rdoubleReadReturns the red component (0..1) for RGB colors, or an approximation for others.
gdoubleReadReturns the green component (0..1) for RGB colors, or an approximation for others.
bdoubleReadReturns the blue component (0..1) for RGB colors, or an approximation for others.
BLACKColorReadBlack (gray 0).
WHITEColorReadWhite (gray 1).
REDColorReadRed (RGB 1, 0, 0).
GREENColorReadGreen (RGB 0, 1, 0).
BLUEColorReadBlue (RGB 0, 0, 1).
YELLOWColorReadYellow (RGB 1, 1, 0).
GRAYColorReadGray (RGB 0.5, 0.5, 0.5).
BLUE_VIOLETColorReadBlue-violet (RGB 138, 43, 226).
TRANSPARENTColorReadFully transparent color (alpha = 0).
LIGHT_GRAYColorReadLight gray color.

Methods

SignatureDescription
getBlack()ColorReturns the predefined black color.
getWhite()ColorReturns the predefined white color.
getRed()ColorReturns the predefined red color.
getGreen()ColorReturns the predefined green color.
getBlue()ColorReturns the predefined blue color.
getYellow()ColorReturns the predefined yellow color.
getGray()ColorReturns the predefined gray color.
getLightGray()ColorReturns the predefined light gray color.
getTransparent()ColorReturns the predefined transparent color.
fromRgb(r: double, g: double, b: double)ColorCreates an RGB color.
fromGray(gray: double)ColorCreates a grayscale color.
fromCmyk(c: double, m: double, y: double, k: double)ColorCreates a CMYK color.
fromArgb(red: int, green: int, blue: int)ColorCreates an RGB color from integer component values in the 0-255 range.
fromArgb(alpha: int, red: int, green: int, blue: int)ColorCreates an RGB color with alpha from integer component values in the 0-255 range.
fromHtml(htmlColor: String)ColorParses an HTML hex color string into a Color.
getAlpha()doubleReturns the alpha (opacity) component of this color.
getColorSpace()ColorSpaceReturns the color space of this color.
getComponents()double[]Returns a copy of the component values.
getR()doubleReturns the red component (0..1) for RGB colors, or an approximation for others.
getG()doubleReturns the green component (0..1) for RGB colors, or an approximation for others.
getB()doubleReturns the blue component (0..1) for RGB colors, or an approximation for others.
equals(o: Object)boolean
hashCode()int
toString()String

See Also