<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(cs)MDLColorSwatchTexture"
  },
  "title" : "MDLColorSwatchTexture"
}
-->

# MDLColorSwatchTexture

A generator of texel data that creates a gradient between two specified colors.

```
class MDLColorSwatchTexture
```

## Overview

A MDLColorSwatchTexture object procedurally generates texel data by creating a gradient between two colors. Like other procedural [`MDLTexture`](/documentation/ModelIO/MDLTexture) subclasses, the [`MDLColorSwatchTexture`](/documentation/ModelIO/MDLColorSwatchTexture) class generates texel data only when that data is first referenced, and caches it for future use.

## Topics

### Creating a Color Swatch Texture

[`-  initWithColorGradientFrom:toColor:name:textureDimensions:`](/documentation/ModelIO/MDLColorSwatchTexture/init(colorGradientFrom:to:name:textureDimensions:))

Initializes a texture that creates a vertical gradient between two colors.

[`-  initWithColorTemperatureGradientFrom:toColorTemperature:name:textureDimensions:`](/documentation/ModelIO/MDLColorSwatchTexture/init(colorTemperatureGradientFrom:toColorTemperature:name:textureDimensions:))

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

## Relationships

### Conforms To

[`MDLNamed`](/documentation/ModelIO/MDLNamed)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`MDLTexture`](/documentation/ModelIO/MDLTexture)

---

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)