---
title: "init(named:inBundle:compatibleWithTraitCollection:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uicolor/init(named:inbundle:compatiblewithtraitcollection:)"
---

# init(named:inBundle:compatibleWithTraitCollection:)

Creates a color object using the named asset that’s compatible with the specified trait collection.

## Declaration

```swift
init?(named name: String, inBundle bundle: Bundle?, compatibleWithTraitCollection traitCollection: UITraitCollection?)
```

## Parameters

- `name`: The name of the asset containing the color.
- `bundle`: The bundle containing the asset.
- `traitCollection`: The trait collection that specifies the gamut to use when selecting the color.

## Return Value

Return Value An initialized color object. The returned object uses the color space specified for the asset.
