# Analysis Functions

**Available functions:**

* [`get_temperature`](#get-temperature)`(rgb)`: Determine the temperature of a color based on its RGB values.
* [`is_neutral`](#is-neutral)`(rgb)`: Check if a color is neutral.
* [`brightness`](#brightness)`(rgb)`: Calculate the brightness of a color.
* [`is_pastel`](#is-pastel)`(rgb)`: Check if a color is pastel.
* [`is_muted`](#is-muted)`(rgb)`: Check if a color is muted.
* [`is_vibrant`](#is-vibrant)`(rgb)`: Check if a color is vibrant.
* [`rgb_to_linear`](#rgb-to-linear)`(rgb)`: Convert RGB values to linear RGB.
* [`get_luminance`](#get-luminance)`(rgb)`: Calculate the relative luminance of an RGB color.
* [`get_vibrancy`](#get-vibrancy)`(rgb)`: Calculate the vibrancy of an RGB color.
* [`color_contrast`](#color-contrast)`(color1, color2)`: Calculates the contrast ratio between two colors using their RGB values.
* [`get_text_color_from_background`](#get-text-color-from-background)`(background_color)`:  Determines whether the text should be "light" or "dark" based on the background color.

***

### Get temperature

Determine the temperature of a color based on its RGB values.

<pre><code>Parameters:
    rgb (tuple): A tuple containing the RGB values (r, g, b).

Returns:
<strong>    str: "Warm" if the color is warm, "Cool" if cool, or "Neutral" if neither.
</strong></code></pre>

### Is neutral

Check if a color is neutral.

<pre><code>Parameters:
<strong>    rgb (tuple): A tuple containing the RGB values (r, g, b).
</strong>
Returns:
    bool: True if the color is neutral, False otherwise.
</code></pre>

### Brightness

Calculate the brightness of a color.

```
Parameters:
    rgb (tuple): A tuple containing the RGB values (r, g, b).

Returns:
    float: The brightness of the color as a value between 0 and 1.
```

### Is pastel

Check if a color is pastel.

```
Parameters:
    rgb (tuple): A tuple containing the RGB values (r, g, b).

Returns:
    bool: True if the color is pastel, False otherwise.
```

### Is muted

Check if a color is muted.

```
Parameters:
    rgb (tuple): A tuple containing the RGB values (r, g, b).

Returns:
    bool: True if the color is muted, False otherwise.
```

### Is vibrant

Check if a color is vibrant.

```
Parameters:
    rgb (tuple): A tuple containing the RGB values (r, g, b).

Returns:
    bool: True if the color is vibrant, False otherwise.
```

### RGB to linear

Convert RGB values to linear RGB.

<pre data-overflow="wrap"><code>Parameters:
<strong>    rgb (tuple): A tuple of three integers representing the RGB values (r, g, b), each in the range [0, 255].
</strong>
Returns:
    list: A list of three floats representing the linear RGB values.
</code></pre>

### Get luminance

Calculate the relative luminance of an RGB color.

{% code overflow="wrap" %}
```
Parameters:
    rgb (tuple): A tuple of three integers representing the RGB values (r, g, b), each in the range [0, 255].

Returns:
    float: The calculated relative luminance of the RGB color.
```
{% endcode %}

### Get vibrancy

&#x20;Calculate the vibrancy of an RGB color.

{% code overflow="wrap" %}
```
Parameters:
    rgb (tuple): A tuple of three integers representing the RGB values (r, g, b), each in the range [0, 255].

Returns:
    float: The calculated vibrancy of the RGB color.
```
{% endcode %}

### Color contrast

&#x20;Calculate the vibrancy of an RGB color.

{% code overflow="wrap" %}
```
Parameters:
    color1 (tuple): The first RGB color as a tuple of three integers (R, G, B).
    color2 (tuple): The second RGB color as a tuple of three integers (R, G, B).

Returns:
    float: The contrast ratio between the two colors.
```
{% endcode %}

### Get text color from background

&#x20;Determines whether the text should be "light" or "dark" based on the background color.

{% code overflow="wrap" %}
```
Parameters:
    background_color (tuple): The background RGB color as a tuple of three integers (R, G, B).

Returns:
    str: "light" if the background is dark and vibrant, "dark" if the background is bright and muted.
```
{% endcode %}
