# ColorSpace Class

> Base class for all color spaces.

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ColorSpace
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class ColorSpace
```

**Namespace:** `com::datalogics::PDFL`

**Derived classes:** [`CalGrayColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CalGrayColorSpace.md), [`CalRGBColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CalRGBColorSpace.md), [`DeviceNColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/DeviceNColorSpace.md), [`ICCBasedColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ICCBasedColorSpace.md), [`IndexedColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/IndexedColorSpace.md), [`LabColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/LabColorSpace.md), [`NamedColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/NamedColorSpace.md), [`SeparationColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/SeparationColorSpace.md)

## Description

Base class for all color spaces.

**Referenced by:** [`AxialShadingPattern`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/AxialShadingPattern.md), [`CalGrayColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CalGrayColorSpace.md), [`CalRGBColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CalRGBColorSpace.md), [`Color`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Color.md), [`ColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ColorSpace.md), [`Content`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Content.md), [`DeviceNColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/DeviceNColorSpace.md), [`DrawParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/DrawParams.md), [`ICCBasedColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ICCBasedColorSpace.md), [`Image`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Image.md), [`IndexedColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/IndexedColorSpace.md), [`LabColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/LabColorSpace.md), [`NamedColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/NamedColorSpace.md), [`PageImageParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PageImageParams.md), [`SeparationColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/SeparationColorSpace.md), [`Shading`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Shading.md), [`ShadingPattern`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ShadingPattern.md)

**Uses types:** [`ColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ColorSpace.md), [`PDFObject`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PDFObject.md)

## Fields

### DEVICE_CMYK

```java
static final ColorSpace com.datalogics.PDFL.ColorSpace.DEVICE_CMYK
```

*static*

The DeviceCMYK color space, representing cyan, magenta, yellow, and black components.

### DEVICE_GRAY

```java
static final ColorSpace com.datalogics.PDFL.ColorSpace.DEVICE_GRAY
```

*static*

The DeviceGray color space, representing a single grayscale component.

### DEVICE_RGB

```java
static final ColorSpace com.datalogics.PDFL.ColorSpace.DEVICE_RGB
```

*static*

The DeviceRGB color space, representing red, green, and blue components.

### DEVICE_RGBA

```java
static final ColorSpace com.datalogics.PDFL.ColorSpace.DEVICE_RGBA
```

*static*

The DeviceRGBA color space, representing red, green, blue, and alpha components.

### LAB

```java
static final ColorSpace com.datalogics.PDFL.ColorSpace.LAB
```

*static*

The CIE-based L*a*b* color space.

### LAB_A

```java
static final ColorSpace com.datalogics.PDFL.ColorSpace.LAB_A
```

*static*

The CIE-based L*a*b* color space with an alpha component.

## Methods

### delete

```java
synchronized void com.datalogics.PDFL.ColorSpace.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.ColorSpace.delete()
```

**Returns:** `synchronized void`

### equals

```java
boolean com.datalogics.PDFL.ColorSpace.equals(Object rhs)
```

**Parameters**

- `rhs` (`Object`)

**Returns:** `boolean`

### finalize

```java
void com.datalogics.PDFL.ColorSpace.finalize()
```

*protected*

**Returns:** `void`

### getName

```java
String com.datalogics.PDFL.ColorSpace.getName()
```

**Returns:** `String`

The name of the color space. A named color space may be named something like DeviceRGB. More complicated color spaces may have a name like Indexed or ICCBased.

### getNumComponents

```java
int com.datalogics.PDFL.ColorSpace.getNumComponents()
```

**Returns:** `int`

The number of color components.

The number of components in the color space. For example, DeviceGray has 1 component, DeviceRGB has 3, and DeviceCMYK has 4.

### getPDFObject

```java
PDFObject com.datalogics.PDFL.ColorSpace.getPDFObject()
```

**Returns:** [`PDFObject`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PDFObject.md)

The PDFObject associated with the color space.

Get the PDFObject associated with the color space. This may be a PDFName, PDFDict, PDFStream, or PDFArray.

### toString

```java
String com.datalogics.PDFL.ColorSpace.toString()
```

**Returns:** `String`

A string describing this ColorSpace.

Convert a ColorSpace to a string representation.
