# `Visualize.Scale.Color`
[🔗](https://github.com/dcoai/Visualize/blob/v0.8.3/lib/visualize/scale/color.ex#L1)

Color scales for encoding data with colors.

Provides sequential and diverging color scales with various built-in
color schemes.

# `t`

```elixir
@type t() :: %Visualize.Scale.Color{
  clamp?: boolean(),
  domain: [number()],
  interpolator: (number() -&gt; String.t()) | [String.t()],
  type: :sequential | :diverging
}
```

# `apply`

```elixir
@spec apply(t(), number()) :: String.t()
```

Applies the scale to get a color

# `bandwidth`

```elixir
@spec bandwidth(t()) :: 0
```

Returns `0`: a color scale has no bandwidth

# `clamp`

```elixir
@spec clamp(t(), boolean()) :: t()
```

Enables or disables clamping

# `diverging`

```elixir
@spec diverging(atom() | [String.t()] | (number() -&gt; String.t())) :: t()
```

Creates a diverging color scale

# `domain`

```elixir
@spec domain(t(), [number()]) :: t()
```

Sets the domain

# `invert`

```elixir
@spec invert(t(), any()) :: nil
```

Returns `nil`: a color scale is not invertible

# `nice`

```elixir
@spec nice(t()) :: t()
```

Identity

# `padding`

```elixir
@spec padding(t(), number()) :: t()
```

Identity: a color scale has no padding

# `range`

```elixir
@spec range(t(), atom() | [String.t()]) :: t()
```

Sets the range (color interpolator)

# `scheme`

```elixir
@spec scheme(atom()) :: [String.t()] | nil
```

Gets a color scheme by name

# `schemes`

```elixir
@spec schemes() :: [atom()]
```

Returns the list of available color schemes

# `sequential`

```elixir
@spec sequential(atom() | [String.t()] | (number() -&gt; String.t())) :: t()
```

Creates a sequential color scale

# `ticks`

```elixir
@spec ticks(t(), integer()) :: [number()]
```

`Linear.ticks/2` over the domain's extent: `[d0, d1]` sequential, `[d0, d2]` diverging

---

*Consult [api-reference.md](api-reference.md) for complete listing*
