<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLColorSwatchTexture/init(colorTemperatureGradientFrom:toColorTemperature:name:textureDimensions:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLColorSwatchTexture(im)initWithColorTemperatureGradientFrom:toColorTemperature:name:textureDimensions:"
  },
  "title" : "init(colorTemperatureGradientFrom:toColorTemperature:name:textureDimensions:)"
}
-->

# init(colorTemperatureGradientFrom:toColorTemperature:name:textureDimensions:)

Initializes a texture that creates a vertical gradient between two color temperatures.

```
init(colorTemperatureGradientFrom colorTemperature1: Float, toColorTemperature colorTemperature2: Float, name: String?, textureDimensions: vector_int2)
```

## Parameters

`colorTemperature1`

The black-body color temperature, in Kelvins, at the top of the gradient.

`colorTemperature2`

The black-body color temperature, in Kelvins, at the bottom of the gradient.

`name`

The [`name`](/documentation/ModelIO/MDLNamed/name) property for the new texture object.

`textureDimensions`

The texel dimensions (width and height) of the texture image.

## Return Value

A new color swatch texture object.

## Discussion

Real-world light sources often measure color of illumination based on a black-body temperature scale. For example, the colors and characterizations of typical home and office light fixtures correspond to the following temperatures:

|Label          |Color                          |Temperature|
|---------------|-------------------------------|-----------|
|“Soft white”   |Warm, yellowish white          |2700 K     |
|“Bright white” |Pale yellowish white           |3000 K     |
|“Daylight”     |Bright, slightly greenish white|5000 K     |
|“Cool daylight”|Bright, slightly bluish white  |6500 K     |

This initializer does not generate texel data; the [`MDLColorSwatchTexture`](/documentation/ModelIO/MDLColorSwatchTexture) class automatically generates data and caches it for reuse when you use one of the [`MDLTexture`](/documentation/ModelIO/MDLTexture) methods listed in Accessing Texture Data.

---

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)