Refactor ColorPicker components and improve UI consistency (#795)

* feat: add converters and update bindings in ColorPicker components.

* feat: simplify ColorPicker layout by replacing complex structure with ColorView component.

* feat: remove CornerRadiusToDoubleConverter.

* feat: replace EnumToBoolConverter & ToColorModel with ObjectConverters.Equal.

* feat: set HexInputAlphaPosition to Trailing.

* feat: update ColorView layout and styling for improved UI consistency.

* feat: bind Increment property of ColorSliders to respective TickFrequency and Slider values.

* feat: update ColorView bindings to use new syntax and adjust CornerRadius for improved styling.

* feat: update ColorPicker SelectedIndex Mode to TwoWay.

* feat: sync upstream changes.

* feat: update ColorPicker and ColorView to use SemiColorPalette for improved color selection.

* feat: update ControlTemplate TargetType.

* feat: add AIPurple colors to Palette.

* refactor: display real Hex in HexColorPicker.

* fix: update ColorView bindings to handle null values with a converter.

* refactor: refactor ColorPicker demo.

* refactor: replace RelativeSource bindings with TemplateBinding in ColorView.

* chore: copy ColorView Template to ColorPicker.

* fix: update AlphaEnabled ToggleSwitch content to reflect correct label.

* fix: fix index order in ColorPicker.
This commit is contained in:
Zhang Dian
2026-04-08 00:55:03 +08:00
committed by GitHub
parent 6eaa47e7ce
commit e53e744d1f
15 changed files with 448 additions and 425 deletions

View File

@@ -1,13 +1,12 @@
using Avalonia.Controls;
using Avalonia.Media;
using Avalonia.Utilities;
using Irihi.Avalonia.Shared.Helpers;
namespace Semi.Avalonia.ColorPicker;
public class SemiColorDarkPalette: IColorPalette
public class SemiColorDarkPalette : IColorPalette
{
private static readonly Color[,] Colors = new Color[,]
private static readonly Color[,] Colors = new[,]
{
{
//Red
@@ -217,7 +216,21 @@ public class SemiColorDarkPalette: IColorPalette
Color.FromUInt32(0xFFE6E8EA),
Color.FromUInt32(0xFFF9F9F9),
},
{
//AIPurple
Color.FromUInt32(0xFF3A1770),
Color.FromUInt32(0xFF532394),
Color.FromUInt32(0xFF6F31B8),
Color.FromUInt32(0xFF8D41DB),
Color.FromUInt32(0xFFA744FF),
Color.FromUInt32(0xFFC375FF),
Color.FromUInt32(0xFFD598FF),
Color.FromUInt32(0xFFE5BAFF),
Color.FromUInt32(0xFFF3DDFF),
Color.FromUInt32(0xFFFBF3FF),
},
};
public Color GetColor(int colorIndex, int shadeIndex)
{
return Colors[
@@ -229,4 +242,4 @@ public class SemiColorDarkPalette: IColorPalette
public int ColorCount => Colors.GetLength(0);
public int ShadeCount => Colors.GetLength(1);
}
}