---
title: numberOfComponents
framework: coregraphics
role: symbol
role_heading: Instance Property
path: coregraphics/cgcolor/numberofcomponents
---

# numberOfComponents

Returns the number of color components (including alpha) associated with a color.

## Declaration

```swift
var numberOfComponents: Int { get }
```

## See Also

### Examining a Color

- [alpha](coregraphics/cgcolor/alpha.md)
- [colorSpace](coregraphics/cgcolor/colorspace.md)
- [components](coregraphics/cgcolor/components.md)
- [pattern](coregraphics/cgcolor/pattern.md)
