# `Image.Plug.Pipeline.Ops.ReplaceColor`
[🔗](https://github.com/elixir-image/image_plug/blob/v0.1.0/lib/image/plug/pipeline/ops/replace_color.ex#L1)

Replace one colour in the image with another, with a tolerance.

Wraps `Image.replace_color/2`. Two source-colour selection modes:

* **Threshold** — pick all pixels within `:threshold` of `:from`.
  `:from` may be a hex string (`"#ff0000"`), a CSS-name string
  (`"misty_rose"` or `"misty rose"`), an integer in 0..255, an
  RGB three-tuple, or the atom `:auto` (the average of the
  top-left 10×10 region of the image is used; this is `Image`'s
  documented default).

* **Range** — pick all pixels with channel values between
  `:less_than` and `:greater_than`. When both are set, range mode
  wins over the threshold mode.

In all modes, matched pixels are replaced with `:to` (defaults to
`"#000000"`). When `:blend?` is `true`, the replacement blends
smoothly across the boundary rather than hard-cutting.

# `color`

```elixir
@type color() :: String.t() | atom() | non_neg_integer() | [non_neg_integer()]
```

# `t`

```elixir
@type t() :: %Image.Plug.Pipeline.Ops.ReplaceColor{
  blend?: boolean(),
  from: color() | :auto,
  greater_than: nil | color(),
  less_than: nil | color(),
  threshold: non_neg_integer(),
  to: color()
}
```

---

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