# ContrastBrushConverter

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls-color-picker/primitives/converters/struct-contrastbrushconverter/

**struct** · [`ferroui-controls-color-picker`](/docs/0.5.0/api/ferroui-controls-color-picker/) · v0.5.0

```rust
struct ContrastBrushConverter
```

Gets a solid color brush, either black or white, depending on the luminance of the supplied color.
A default color supplied in the converter parameter may be returned if alpha is below the set threshold.

This is a highly-specialized converter for the color picker.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/converters/contrast_brush_converter.rs#L16)

## Members

- [`new`](#function-new)
- [`alpha_threshold`](#function-alpha_threshold)
- [`set_alpha_threshold`](#function-set_alpha_threshold)

<a id="function-new"></a>

### new

```rust
fn new() -> Self
```

Initializes a new instance of the `ContrastBrushConverter` class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/converters/contrast_brush_converter.rs#L29)

<a id="function-alpha_threshold"></a>

### alpha_threshold

```rust
fn alpha_threshold(self: &Self) -> u8
```

Gets the alpha channel threshold below which a default color is used instead of black/white.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/converters/contrast_brush_converter.rs#L34)

<a id="function-set_alpha_threshold"></a>

### set_alpha_threshold

```rust
fn set_alpha_threshold(self: &Self, value: u8)
```

Sets `alpha_threshold`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls.ColorPicker/converters/contrast_brush_converter.rs#L39)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Debug`
- `Default`
- [`IValueConverter`](/docs/0.5.0/api/ferroui-base/data/converters/trait-ivalueconverter/)
- `PartialEq`
- [`MarkupTyped`](/docs/0.5.0/api/ferroui-base/metadata/trait-markuptyped/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
