> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/custom/ext/color+/color.hue.md).

# color.hue

{% tabs %}
{% tab title="🌀 Color + .hue" %}
{% hint style="warning" %}

* On <mark style="color:red;">**iOS 10 or later**</mark>, an <mark style="color:orange;">**extended range color space**</mark> specifies the <mark style="color:purple;">**hue**</mark> component and can have <mark style="color:red;">**any value**</mark>.  ⭐️
* Values <mark style="color:purple;">**`0.0`**</mark> \~ <mark style="color:purple;">**`1.0`**</mark> are inside the <mark style="color:orange;">**sRGB color gamut**</mark>.&#x20;
* On <mark style="color:red;">**earlier versions of iOS**</mark>, the hue is **always** `0.0` \~ `1.0`.  👉 [UIKit](https://developer.apple.com/documentation/uikit/uicolor/1621949-gethue)
  {% endhint %}

```swift
import  SwiftUI

extension Color {
    /// `color.hue` (0 ~ 1)
    public var hue: CGFloat {
        var hue: CGFloat = 0
        UIColor(self).getHue(
            &hue, 
            saturation: nil, 
            brightness: nil, 
            alpha: nil
        )
        return hue
    }
}
```

{% endtab %}

{% tab title="📘 手冊" %}

* [Core Image](https://developer.apple.com/documentation/coreimage) ⟩ [Applying a Chroma Key Effect](https://developer.apple.com/documentation/coreimage/applying_a_chroma_key_effect) ⭐️ \
  a.k.a. **bluescreening** or **greenscreening**.
* UIKit ⟩ [UIColor](https://developer.apple.com/documentation/uikit/uicolor) ⟩ [.getHue()](https://developer.apple.com/documentation/uikit/uicolor/1621949-gethue)
  {% endtab %}
  {% endtabs %}
