<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Color/init(uiColor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ColorVAAE02uiC0ACSo7UIColorC_tcfc"
  },
  "title" : "init(uiColor:)"
}
-->

# init(uiColor:)

Creates a color from a UIKit color.

```
init(uiColor: UIColor)
```

## Discussion

Use this method to create a SwiftUI color from a
<doc://com.apple.documentation/documentation/UIKit/UIColor> instance.
The new color preserves the adaptability of the original.
For example, you can create a rectangle using
<doc://com.apple.documentation/documentation/UIKit/UIColor/link>
to see how the shade adjusts to match the user’s system settings:

```
struct Box: View {
    var body: some View {
        Color(uiColor: .link)
            .frame(width: 200, height: 100)
    }
}
```

The `Box` view defined above automatically changes its
appearance when the user turns on Dark Mode. With the light and dark
appearances placed side by side, you can see the subtle difference
in shades:

![A side by side comparison of light and dark appearance screenshots of](images/com.apple.SwiftUI/Color-init-3@2x.png)

> Note: Use this initializer only if you need to convert an existing
> <doc://com.apple.documentation/documentation/UIKit/UIColor> to a
> SwiftUI color. Otherwise, create a SwiftUI ``doc://com.apple.SwiftUI/documentation/SwiftUI/Color`` using an
> initializer like ``doc://com.apple.SwiftUI/documentation/SwiftUI/Color/init(_:red:green:blue:opacity:)``, or use a system
> color like ``doc://com.apple.SwiftUI/documentation/SwiftUI/ShapeStyle/blue``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)