# java.awt.color

***

**1. Creating a ColorSpace Object**

```java
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
```

**2. Converting a Color to a Different ColorSpace**

```java
float[] components = {0.5f, 0.5f, 0.5f};
Color color = new Color(components, cs);
```

**3. Getting the Components of a Color**

```java
float[] components = color.getComponents(null);
```

**4. Getting the Alpha Component of a Color**

```java
float alpha = color.getAlpha();
```

**5. Getting the Red Component of a Color**

```java
float red = color.getRed();
```

**6. Getting the Green Component of a Color**

```java
float green = color.getGreen();
```

**7. Getting the Blue Component of a Color**

```java
float blue = color.getBlue();
```

**8. Creating a Color Space Converter**

```java
ColorSpaceConverter csc = ColorSpaceConverter.getInstance(cs, ColorSpace.CS_GRAY);
```

**9. Converting a Color from One Color Space to Another**

```java
float[] components = {0.5f, 0.5f, 0.5f};
Color color = new Color(components, cs);
Color convertedColor = csc.convert(color);
```

**10. Getting the Color Model of a Color Space**

```java
ColorModel cm = cs.getColorModel();
```

**11. Getting the Number of Components in a Color Space**

```java
int numComponents = cs.getNumComponents();
```

**12. Getting the Type of a Color Space**

```java
int type = cs.getType();
```

**13. Creating a ColorTransform Object**

```java
ColorTransform ct = ColorTransform.getInstance(cs, ColorSpace.CS_GRAY);
```

**14. Transforming a Color from One Color Space to Another**

```java
float[] components = {0.5f, 0.5f, 0.5f};
Color color = new Color(components, cs);
Color transformedColor = ct.transform(color);
```

**15. Getting the Color Transform Result**

```java
float[] components = ct.getResult();
```

**16. Getting the Source Color Space of a Color Transform**

```java
ColorSpace srcCS = ct.getSourceColorSpace();
```

**17. Getting the Destination Color Space of a Color Transform**

```java
ColorSpace destCS = ct.getDestinationColorSpace();
```

**18. Creating a ProfileData**

```java
ProfileData pd = new ProfileData(cs);
```

**19. Getting the ICC Profile Data for a Color Space**

```java
byte[] iccProfileData = pd.getData();
```

**20. Getting the Color Space for an ICC Profile Data**

```java
ColorSpace cs = pd.getColorSpace();
```

**21. Creating a ColorConverter**

```java
ColorConverter cc = new ColorConverter(cs);
```

**22. Converting a Color from One Color Space to Another**

```java
float[] components = {0.5f, 0.5f, 0.5f};
Color color = new Color(components, cs);
Color convertedColor = cc.convert(color);
```

**23. Getting the Source Color Space of a ColorConverter**

```java
ColorSpace srcCS = cc.getSourceColorSpace();
```

**24. Getting the Destination Color Space of a ColorConverter**

```java
ColorSpace destCS = cc.getDestinationColorSpace();
```

**25. Creating a ColorExchange**

```java
ColorExchange ce = new ColorExchange(cs);
```

**26. Converting a Color from One Color Space to Another**

```java
float[] components = {0.5f, 0.5f, 0.5f};
Color color = new Color(components, cs);
Color convertedColor = ce.convert(color);
```

**27. Getting the Source Color Space of a ColorExchange**

```java
ColorSpace srcCS = ce.getSourceColorSpace();
```

**28. Getting the Destination Color Space of a ColorExchange**

```java
ColorSpace destCS = ce.getDestinationColorSpace();
```

**29. Creating a ColorCorrection**

```java
ColorCorrection cc = new ColorCorrection(cs);
```

**30. Adjusting the Brightness of a Color**

```java
float brightness = 0.5f;
Color correctedColor = cc.adjustBrightness(color, brightness);
```

**31. Adjusting the Contrast of a Color**

```java
float contrast = 0.5f;
Color correctedColor = cc.adjustContrast(color, contrast);
```

**32. Adjusting the Hue of a Color**

```java
float hue = 0.5f;
Color correctedColor = cc.adjustHue(color, hue);
```

**33. Adjusting the Saturation of a Color**

```java
float saturation = 0.5f;
Color correctedColor = cc.adjustSaturation(color, saturation);
```

**34. Creating a ColorFilter**

```java
ColorFilter cf = new ColorFilter(cs);
```

**35. Filtering a Color**

```java
Color filteredColor = cf.filter(color);
```

**36. Getting the Transfer Function of a Color Filter**

```java
TransferFunction tf = cf.getTransferFunction();
```

**37. Creating a ColorLookupTable**

```java
ColorLookupTable clt = new ColorLookupTable(cs);
```

**38. Setting the Transfer Function of a ColorLookupTable**

```java
TransferFunction tf = new TransferFunction();
clt.setTransferFunction(tf);
```

**39. Lookup a Color in a ColorLookupTable**

```java
Color lookupColor = clt.lookup(color);

```
