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 SemiColorLightPalette: IColorPalette
public class SemiColorLightPalette : IColorPalette
{
private static readonly Color[,] Colors = new Color[,]
private static readonly Color[,] Colors = new[,]
{
{
//Red
@@ -217,7 +216,21 @@ public class SemiColorLightPalette: IColorPalette
Color.FromUInt32(0xFF2E3238),
Color.FromUInt32(0xFF1C1F23),
},
{
//AIPurple
Color.FromUInt32(0xFFF8EDFF),
Color.FromUInt32(0xFFF2DAFF),
Color.FromUInt32(0xFFE3B5FF),
Color.FromUInt32(0xFFD191FF),
Color.FromUInt32(0xFFBD6CFF),
Color.FromUInt32(0xFFA647FF),
Color.FromUInt32(0xFF8636DB),
Color.FromUInt32(0xFF6928B8),
Color.FromUInt32(0xFF4E1C94),
Color.FromUInt32(0xFF361270),
},
};
public Color GetColor(int colorIndex, int shadeIndex)
{
return Colors[