AccentColorConverter Class
Definition
Creates an accent color for a given base color value and step parameter.
public class AccentColorConverter
Remarks
This is a highly-specialized converter for the color picker.
Constructors
| Name | Description |
|---|---|
| AccentColorConverter | No summary available. |
AccentColorConverter Constructor
public AccentColorConverter()
Methods
| Name | Description |
|---|---|
| Convert | Converts a value. |
| ConvertBack | Converts a value. |
| GetAccent | This does not account for perceptual differences and also does not match with system accent color calculation. |
Convert Method
Converts a value.
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Parameters
value object
The value to convert.
targetType Type
The type of the target.
parameter object
A user-defined parameter.
culture System.Globalization.CultureInfo
The culture to use.
Returns
object
The converted value.
Remarks
This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.
ConvertBack Method
Converts a value.
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Parameters
value object
The value to convert.
targetType Type
The type of the target.
parameter object
A user-defined parameter.
culture System.Globalization.CultureInfo
The culture to use.
Returns
object
The converted value.
Remarks
This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.
GetAccent Method
This does not account for perceptual differences and also does not match with system accent color calculation.
public Avalonia.Media.HsvColor GetAccent(Avalonia.Media.HsvColor hsvColor, int accentStep)
Parameters
hsvColor Avalonia.Media.HsvColor
The base color to calculate the accent from.
accentStep int
The number of accent color steps to move.
Returns
The new accent color.
Remarks
Use the HSV representation as it's more perceptual. In most cases only the value is changed by a fixed percentage so the algorithm is reproducible.
Fields
| Name | Description |
|---|---|
| ValueDelta | The amount to change the Value component for each accent color step. |
ValueDelta Field
The amount to change the Value component for each accent color step.
public double ValueDelta