public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is SolidColorBrush soloColorBrush)) { return(null); } return(ColorDto.FromColor(soloColorBrush.Color)); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { if (!(value is Color color)) { return(null); } return(ColorDto.FromColor(color)); }
private ColorDto[] InitializeColorPalette(ColorDto fromColor, ColorDto toColor, int steps) { HSLColor fromHslColor = HSLColor.FromRGB(fromColor.Red, fromColor.Green, fromColor.Blue); HSLColor toHslColor = HSLColor.FromRGB(toColor.Red, toColor.Green, toColor.Blue); List <ColorDto> colors = new List <ColorDto>(); double step = 1.0 / (steps + 1); for (int i = 0; i < steps + 1; i++) { HSLColor currentColor = HSLColor.Interpolate(fromHslColor, toHslColor, step * i); colors.Add(ColorDto.FromColor(currentColor.ToColor().ToMediaColor())); } colors.Add(toColor); return(colors.ToArray()); }
public ColorDto GetNextAsDto() { return(ColorDto.FromColor(GetNext())); }