One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

Color.Resolved

struct · iOS 17.0+ · SDK 27.1

@frozen struct Resolved

A concrete color value. `Color.Resolved` is a set of RGBA values that represent a color that can be shown. The values are stored in the Linear sRGB color space, using extended range. This is a low-level type, most colors are represented by the `Color` type. - SeeAlso: `Color.ResolvedHDR`, `Color`.

Members (19)

get · iOS 17.0+

cgColor

TypeScript
get cgColor(): _CoreGraphics_CGColor
Swift declaration
var cgColor: CGColor { get }

A Core Graphics representation of the color. You can get a <doc://com.apple.documentation/documentation/CoreGraphics/CGColor> instance from a resolved color.

init · iOS 17.0+

init

TypeScript
static init(colorSpace: Color_RGBColorSpace, red: number, green: number, blue: number, opacity?: number): Color_Resolved
Swift declaration
init(colorSpace: Color.RGBColorSpace = .sRGB, red: Float, green: Float, blue: Float, opacity: Float = 1)

Creates a resolved color from red, green, and blue component values. A standard sRGB color space clamps each color component — `red`, `green`, and `blue` — to a range of `0` to `1`, but SwiftUI colors use an extended sRGB color space, so you can use component values outside that range. This makes it possible to create colors using the ``RGBColorSpace/sRGB`` or ``RGBColorSpace/sRGBLinear`` color space that make full use of the wider gamut of a diplay that supports ``RGBColorSpace/displayP3``. - Parameters: - colorSpace: The profile that specifies how to interpret the color for display. The default is ``RGBColorSpace/sRGB``. - red: The amount of red in the color. - green: The amount of green in the color. - blue: The amount of blue in the color. - opacity: An optional degree of opacity, given in the range `0` to `1`. A value of `0` means 100% transparency, while a value of `1` means 100% opacity. The default is `1`.

get · iOS 17.0+

linearBlue

TypeScript
get linearBlue(): number
Swift declaration
var linearBlue: Float

The amount of blue in the color in the sRGB linear color space.

set · iOS 17.0+

linearBlue

TypeScript
set linearBlue(value: number)
Swift declaration
var linearBlue: Float

The amount of blue in the color in the sRGB linear color space.

get · iOS 17.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A textual representation of this instance. Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the `String(describing:)` initializer. This initializer works with any type, and uses the custom `description` property for types that conform to `CustomStringConvertible`: struct Point: CustomStringConvertible { let x: Int, y: Int var description: String { return "(\(x), \(y))" } } let p = Point(x: 21, y: 30) let s = String(describing: p) print(s) // Prints "(21, 30)" The conversion of `p` to a string in the assignment to `s` uses the `Point` type's `description` property.

get · iOS 17.0+

linearGreen

TypeScript
get linearGreen(): number
Swift declaration
var linearGreen: Float

The amount of green in the color in the sRGB linear color space.

set · iOS 17.0+

linearGreen

TypeScript
set linearGreen(value: number)
Swift declaration
var linearGreen: Float

The amount of green in the color in the sRGB linear color space.

get · iOS 17.0+

animatableData

TypeScript
get animatableData(): AnimatablePair<number, AnimatablePair<number, AnimatablePair<number, number>>>
Swift declaration
var animatableData: Color.Resolved.AnimatableData { get set }

The data to animate. SwiftUI reads this property to capture the current vector representation of the animatable state, and writes it back on each animation frame with an interpolated value. The default implementation returns ``EmptyAnimatableData``, meaning nothing is animated. Use the ``Animatable()`` macro to synthesize this property automatically. Implement it by hand only when you need custom interpolation logic such as clamping, normalization, or mapping to a derived value.

set · iOS 17.0+

animatableData

TypeScript
set animatableData(value: AnimatablePair<number, AnimatablePair<number, AnimatablePair<number, number>>>)
Swift declaration
var animatableData: Color.Resolved.AnimatableData { get set }

The data to animate. SwiftUI reads this property to capture the current vector representation of the animatable state, and writes it back on each animation frame with an interpolated value. The default implementation returns ``EmptyAnimatableData``, meaning nothing is animated. Use the ``Animatable()`` macro to synthesize this property automatically. Implement it by hand only when you need custom interpolation logic such as clamping, normalization, or mapping to a derived value.

get · iOS 17.0+

red

TypeScript
get red(): number
Swift declaration
var red: Float { get set }

The amount of red in the color in the sRGB color space.

set · iOS 17.0+

red

TypeScript
set red(value: number)
Swift declaration
var red: Float { get set }

The amount of red in the color in the sRGB color space.

get · iOS 17.0+

blue

TypeScript
get blue(): number
Swift declaration
var blue: Float { get set }

The amount of blue in the color in the sRGB color space.

set · iOS 17.0+

blue

TypeScript
set blue(value: number)
Swift declaration
var blue: Float { get set }

The amount of blue in the color in the sRGB color space.

get · iOS 17.0+

green

TypeScript
get green(): number
Swift declaration
var green: Float { get set }

The amount of green in the color in the sRGB color space.

set · iOS 17.0+

green

TypeScript
set green(value: number)
Swift declaration
var green: Float { get set }

The amount of green in the color in the sRGB color space.

get · iOS 17.0+

opacity

TypeScript
get opacity(): number
Swift declaration
var opacity: Float

The degree of opacity in the color, given in the range `0` to `1`. A value of `0` means 100% transparency, while a value of `1` means 100% opacity.

set · iOS 17.0+

opacity

TypeScript
set opacity(value: number)
Swift declaration
var opacity: Float

The degree of opacity in the color, given in the range `0` to `1`. A value of `0` means 100% transparency, while a value of `1` means 100% opacity.

get · iOS 17.0+

linearRed

TypeScript
get linearRed(): number
Swift declaration
var linearRed: Float

The amount of red in the color in the sRGB linear color space.

set · iOS 17.0+

linearRed

TypeScript
set linearRed(value: number)
Swift declaration
var linearRed: Float

The amount of red in the color in the sRGB linear color space.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →