---
title: "init(colorTemperatureGradientFrom:toColorTemperature:name:textureDimensions:)"
framework: modelio
role: symbol
role_heading: Initializer
path: "modelio/mdlcolorswatchtexture/init(colortemperaturegradientfrom:tocolortemperature:name:texturedimensions:)"
---

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

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

## Declaration

```swift
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 doc://com.apple.modelio/documentation/ModelIO/MDLNamed/name property for the new texture object.
- `textureDimensions`: The texel dimensions (width and height) of the texture image.

## Return Value

Return Value A new color swatch texture object.

## Discussion

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:  |  |   |  |   |  |   |  |   |  |  This initializer does not generate texel data; the MDLColorSwatchTexture class automatically generates data and caches it for reuse when you use one of the MDLTexture methods listed in Accessing Texture Data.

## See Also

### Creating a Color Swatch Texture

- [init(colorGradientFrom:to:name:textureDimensions:)](modelio/mdlcolorswatchtexture/init(colorgradientfrom:to:name:texturedimensions:).md)
