From f0642982bc0a593cb46a4f32c8d4d219b0372aea Mon Sep 17 00:00:00 2001 From: yuzh <46953451+yuzh0816@users.noreply.github.com> Date: Thu, 29 Aug 2024 10:34:20 +0800 Subject: [PATCH] modify: Merge SukiUI --- SukiUI/ColorTheme/Dark.axaml | 12 ++-- SukiUI/ColorTheme/Light.axaml | 9 ++- SukiUI/ColorTheme/NotificationColor.cs | 52 ++++++++++++-- SukiUI/Content/Shaders/Background/bubble.sksl | 14 ++-- .../Shaders/Background/bubblestrong.sksl | 10 +-- SukiUI/Content/Shaders/Background/flat.sksl | 2 +- .../Content/Shaders/Background/gradient.sksl | 14 ++-- SukiUI/Controls/GlassMorphism/GlassCard.axaml | 31 ++++++++- SukiUI/Controls/GroupBox.axaml | 8 +-- SukiUI/Controls/InfoBadge.axaml | 4 +- SukiUI/Controls/InfoBadge.axaml.cs | 14 ++-- SukiUI/Controls/InfoBar.axaml.cs | 12 ++-- .../PropertyGridTemplateSelector.axaml | 4 +- .../PropertyGridTemplateSelector.axaml.cs | 27 ++++---- SukiUI/Controls/SukiSideMenu.axaml | 14 ++-- SukiUI/Controls/SukiWindow.axaml | 3 +- SukiUI/Controls/SukiWindow.axaml.cs | 5 ++ SukiUI/Enums/SukiBackgroundStyle.cs | 2 +- SukiUI/Enums/ToastLocation.cs | 4 +- SukiUI/Models/SukiColorTheme.cs | 6 +- SukiUI/Theme/Button.axaml | 2 +- SukiUI/Theme/CalendarDatePickerStyle.axaml | 10 ++- SukiUI/Theme/CheckBoxStyles.axaml | 38 +++-------- SukiUI/Theme/ComboBoxStyles.xaml | 30 ++++---- SukiUI/Theme/DatePicker.axaml | 18 +++-- SukiUI/Theme/DropDownButton.axaml | 15 ++-- SukiUI/Theme/FlyoutPresenter.axaml | 2 +- SukiUI/Theme/HyperlinkButton.axaml | 21 +++--- SukiUI/Theme/Index.axaml | 3 +- SukiUI/Theme/Menu.axaml | 11 ++- SukiUI/Theme/MenuFlyoutPresenter.axaml | 14 ++-- SukiUI/Theme/MenuItem.axaml | 15 +--- SukiUI/Theme/NumericUpDownStyles.xaml | 17 +++-- SukiUI/Theme/ProgressBarStyles.xaml | 20 +++--- SukiUI/Theme/RadioButtonStyles.xaml | 56 +++------------ SukiUI/Theme/Separator.axaml | 36 ++++++++++ SukiUI/Theme/SliderStyles.xaml | 18 ++--- SukiUI/Theme/TabControl.axaml | 19 +++++- SukiUI/Theme/TextBoxStyles.xaml | 61 +++++++++++------ SukiUI/Theme/TimePickerStyle.axaml | 25 ++++--- SukiUI/Theme/ToggleSwitchStyles.xaml | 68 ++++++++++++++++--- SukiUI/Utilities/Effects/SukiEffect.cs | 1 + 42 files changed, 456 insertions(+), 291 deletions(-) create mode 100644 SukiUI/Theme/Separator.axaml diff --git a/SukiUI/ColorTheme/Dark.axaml b/SukiUI/ColorTheme/Dark.axaml index ac455d52..facb4f48 100644 --- a/SukiUI/ColorTheme/Dark.axaml +++ b/SukiUI/ColorTheme/Dark.axaml @@ -4,7 +4,7 @@ Transparent #353535 Transparent - #292929 + #323232 #49aaaaaa #333333 #505050 @@ -24,10 +24,10 @@ 0 1 5 0 #555555 0 0 4 1 #101010 1 1 14 1 #101010 - 1 1 15 0 #606060 + 1 4 17 0 #111111 - + @@ -36,7 +36,9 @@ False 0.18 - 0.18 - 0.57 + + 0.3 + 0.17 + #49aaaaaa \ No newline at end of file diff --git a/SukiUI/ColorTheme/Light.axaml b/SukiUI/ColorTheme/Light.axaml index 3ffc3dd6..38caa0bf 100644 --- a/SukiUI/ColorTheme/Light.axaml +++ b/SukiUI/ColorTheme/Light.axaml @@ -24,7 +24,7 @@ 0 1 5 0 #aaaaaa 0 0 2 0 DimGray 1 1 8 0 LightGray - 1 1 15 0 #dedede + 1 4 17 0 #999999 @@ -36,6 +36,9 @@ True 0.42 - 0.3 - 0.42 + + 0.05 + 0.4 + #fd111111 + diff --git a/SukiUI/ColorTheme/NotificationColor.cs b/SukiUI/ColorTheme/NotificationColor.cs index af4355dc..d9211a8f 100644 --- a/SukiUI/ColorTheme/NotificationColor.cs +++ b/SukiUI/ColorTheme/NotificationColor.cs @@ -1,11 +1,53 @@ -using Avalonia.Media; +using Avalonia; +using Avalonia.Media; +using Avalonia.Styling; namespace SukiUI.ColorTheme; public static class NotificationColor { - public static readonly SolidColorBrush InfoIconForeground = new(Color.FromRgb(47,84,235)); - public static readonly SolidColorBrush SuccessIconForeground = new(Color.FromRgb(56,158,13)); - public static readonly SolidColorBrush WarningIconForeground = new(Color.FromRgb(240,140,22)); - public static readonly SolidColorBrush ErrorIconForeground = new(Color.FromRgb(236,63,48)); + public static readonly LinearGradientBrush InfoIconForeground = new LinearGradientBrush() + { + EndPoint = new RelativePoint(0, 0, RelativeUnit.Relative), + StartPoint = new RelativePoint(1, 1, RelativeUnit.Relative), + GradientStops = new GradientStops() + { + new() { Color = Color.FromRgb(89,126,247), Offset = 0.3 }, + new() { Color = Color.FromRgb(47,84,235), Offset = 1 }, + + } + }; + public static readonly LinearGradientBrush SuccessIconForeground = new LinearGradientBrush() + { + EndPoint = new RelativePoint(0, 0, RelativeUnit.Relative), + StartPoint = new RelativePoint(1, 1, RelativeUnit.Relative), + GradientStops = new GradientStops() + { + new() { Color = Color.FromRgb(82,196,26), Offset = 0.3 }, + new() { Color = Color.FromRgb(56,158,13), Offset = 1 }, + + } + }; + public static readonly LinearGradientBrush WarningIconForeground = new LinearGradientBrush() + { + EndPoint = new RelativePoint(0, 0, RelativeUnit.Relative), + StartPoint = new RelativePoint(1, 1, RelativeUnit.Relative), + GradientStops = new GradientStops() + { + new() { Color = Color.FromRgb(255,169,64), Offset = 0.3 }, + new() { Color = Color.FromRgb(250,140,22), Offset = 1 }, + + } + }; + public static readonly LinearGradientBrush ErrorIconForeground = new LinearGradientBrush() + { + EndPoint = new RelativePoint(0, 0, RelativeUnit.Relative), + StartPoint = new RelativePoint(1, 1, RelativeUnit.Relative), + GradientStops = new GradientStops() + { + new() { Color = Color.FromRgb(255,77,79), Offset = 0.3 }, + new() { Color = Color.FromRgb(245,34,45), Offset = 1 }, + + } + }; } \ No newline at end of file diff --git a/SukiUI/Content/Shaders/Background/bubble.sksl b/SukiUI/Content/Shaders/Background/bubble.sksl index 57f2fc15..6c2b450c 100644 --- a/SukiUI/Content/Shaders/Background/bubble.sksl +++ b/SukiUI/Content/Shaders/Background/bubble.sksl @@ -13,9 +13,9 @@ vec3 blendOverlay(vec3 base, vec3 blend) { vec3 blendOverlayDark(vec3 base, vec3 blend) { vec3 result; - result.r = (base.r < 0.5) ? (4 * base.r * blend.r) : (3.5 - 2.0 * (3 - base.r) * (3.5 - blend.r)); - result.g = (base.g < 0.5) ? (4 * base.g * blend.g) : (3.5 - 2.0 * (3 - base.g) * (3.5 - blend.g)); - result.b = (base.b < 0.5) ? (4 * base.b * blend.b) : (3.5 - 2.0 * (3 - base.b) * (3.5 - blend.b)); + result.r = (base.r < 0.5) ? (5 * base.r * blend.r) : (4 - 2.0 * (3 - base.r) * (4 - blend.r)); + result.g = (base.g < 0.5) ? (5 * base.g * blend.g) : (4 - 2.0 * (3 - base.g) * (4 - blend.g)); + result.b = (base.b < 0.5) ? (5 * base.b * blend.b) : (4 - 2.0 * (3 - base.b) * (4 - blend.b)); return mix(base, clamp(result, 0.0, 1.0), 0.5); // Mélange avec la couleur de base pour réduire l'assombrissement } @@ -66,16 +66,16 @@ vec4 main(vec2 fragCoord) { float opacityLayer2 = 0.85 - (iDark / 2); - float iPrimaryOpacity = 1; // Exemple de nouvelle opacité pour iPrimary + float iPrimaryOpacity = 1.1; if (iDark == 1) { - iPrimaryOpacity = 0.28; + iPrimaryOpacity = 0.52; } vec3 iPrimaryWithOpacity = iPrimary * iPrimaryOpacity; - float iAccentOpacity = 0.8; + float iAccentOpacity = 1; if (iDark == 1) { - iAccentOpacity = 0.34; + iAccentOpacity = 0.9; } vec3 iAccentWithOpacity = iAccent * iAccentOpacity; diff --git a/SukiUI/Content/Shaders/Background/bubblestrong.sksl b/SukiUI/Content/Shaders/Background/bubblestrong.sksl index 2ae3213c..47f2665d 100644 --- a/SukiUI/Content/Shaders/Background/bubblestrong.sksl +++ b/SukiUI/Content/Shaders/Background/bubblestrong.sksl @@ -13,9 +13,9 @@ vec3 blendOverlay(vec3 base, vec3 blend) { vec3 blendOverlayDark(vec3 base, vec3 blend) { vec3 result; - result.r = (base.r < 0.5) ? (4 * base.r * blend.r) : (3.5 - 2.0 * (3 - base.r) * (3.5 - blend.r)); - result.g = (base.g < 0.5) ? (4 * base.g * blend.g) : (3.5 - 2.0 * (3 - base.g) * (3.5 - blend.g)); - result.b = (base.b < 0.5) ? (4 * base.b * blend.b) : (3.5 - 2.0 * (3 - base.b) * (3.5 - blend.b)); + result.r = (base.r < 0.5) ? (5 * base.r * blend.r) : (4 - 2.0 * (3 - base.r) * (4 - blend.r)); + result.g = (base.g < 0.5) ? (5 * base.g * blend.g) : (4 - 2.0 * (3 - base.g) * (4 - blend.g)); + result.b = (base.b < 0.5) ? (5 * base.b * blend.b) : (4 - 2.0 * (3 - base.b) * (4 - blend.b)); return mix(base, clamp(result, 0.0, 1.0), 0.5); // Mélange avec la couleur de base pour réduire l'assombrissement } @@ -68,14 +68,14 @@ vec4 main(vec2 fragCoord) { float iPrimaryOpacity = 1.1; // Exemple de nouvelle opacité pour iPrimary if (iDark == 1) { - iPrimaryOpacity = 0.34; + iPrimaryOpacity = 0.52; } vec3 iPrimaryWithOpacity = iPrimary * iPrimaryOpacity; float iAccentOpacity = 1; if (iDark == 1) { - iAccentOpacity = 0.55; + iAccentOpacity = 0.9; } vec3 iAccentWithOpacity = iAccent * iAccentOpacity; diff --git a/SukiUI/Content/Shaders/Background/flat.sksl b/SukiUI/Content/Shaders/Background/flat.sksl index b3d36523..c671dcff 100644 --- a/SukiUI/Content/Shaders/Background/flat.sksl +++ b/SukiUI/Content/Shaders/Background/flat.sksl @@ -1,7 +1,7 @@ vec4 main(vec2 fragCoord) { if(iDark == 1) - return vec4(iBase * 0.7, iAlpha); + return vec4(iBase * 1, iAlpha); return vec4(iBase, iAlpha); } \ No newline at end of file diff --git a/SukiUI/Content/Shaders/Background/gradient.sksl b/SukiUI/Content/Shaders/Background/gradient.sksl index b071e431..0daeb7dd 100644 --- a/SukiUI/Content/Shaders/Background/gradient.sksl +++ b/SukiUI/Content/Shaders/Background/gradient.sksl @@ -13,9 +13,9 @@ vec3 blendOverlay(vec3 base, vec3 blend) { vec3 blendOverlayDark(vec3 base, vec3 blend) { vec3 result; - result.r = (base.r < 0.5) ? (4 * base.r * blend.r) : (3.5 - 2.0 * (3 - base.r) * (3.5 - blend.r)); - result.g = (base.g < 0.5) ? (4 * base.g * blend.g) : (3.5 - 2.0 * (3 - base.g) * (3.5 - blend.g)); - result.b = (base.b < 0.5) ? (4 * base.b * blend.b) : (3.5 - 2.0 * (3 - base.b) * (3.5 - blend.b)); + result.r = (base.r < 0.5) ? (2 * base.r * blend.r) : (4 - 1.5 * (3 - base.r) * (4 - blend.r)); + result.g = (base.g < 0.5) ? (2* base.g * blend.g) : (4 - 1.5 * (3 - base.g) * (4 - blend.g)); + result.b = (base.b < 0.5) ? (2 * base.b * blend.b) : (4 - 1.5 * (3 - base.b) * (4 - blend.b)); return mix(base, clamp(result, 0.0, 1.0), 0.5); // Mélange avec la couleur de base pour réduire l'assombrissement } @@ -66,16 +66,16 @@ vec4 main(vec2 fragCoord) { float opacityLayer2 = 0.85 - (iDark / 2); - float iPrimaryOpacity = 0.8; // Exemple de nouvelle opacité pour iPrimary + float iPrimaryOpacity = 0.2; // Exemple de nouvelle opacité pour iPrimary if (iDark == 1) { - iPrimaryOpacity = 0.32; + iPrimaryOpacity = 0.4; } vec3 iPrimaryWithOpacity = iPrimary * iPrimaryOpacity; - float iAccentOpacity = 0; + float iAccentOpacity = 1; if (iDark == 1) { - iAccentOpacity = 0; + iAccentOpacity = 2; } vec3 iAccentWithOpacity = iPrimary * iAccentOpacity; diff --git a/SukiUI/Controls/GlassMorphism/GlassCard.axaml b/SukiUI/Controls/GlassMorphism/GlassCard.axaml index f3984536..d1a3ab06 100644 --- a/SukiUI/Controls/GlassMorphism/GlassCard.axaml +++ b/SukiUI/Controls/GlassMorphism/GlassCard.axaml @@ -3,13 +3,14 @@ xmlns:suki="clr-namespace:SukiUI.Controls"> + + + + + + + + + + @@ -79,6 +103,11 @@ + + diff --git a/SukiUI/Controls/GroupBox.axaml b/SukiUI/Controls/GroupBox.axaml index d0f95837..3aa78f6b 100644 --- a/SukiUI/Controls/GroupBox.axaml +++ b/SukiUI/Controls/GroupBox.axaml @@ -11,7 +11,7 @@ diff --git a/SukiUI/Controls/InfoBadge.axaml b/SukiUI/Controls/InfoBadge.axaml index ecddd1fe..96c1b5d3 100644 --- a/SukiUI/Controls/InfoBadge.axaml +++ b/SukiUI/Controls/InfoBadge.axaml @@ -8,7 +8,7 @@ Height="400" Margin="0,20,0,0" Spacing="20"> - @@ -34,7 +34,7 @@ IsDot="True"> --> @@ -57,12 +57,12 @@ - - + @@ -73,7 +73,7 @@ - + diff --git a/SukiUI/Controls/SukiWindow.axaml b/SukiUI/Controls/SukiWindow.axaml index 4bd9993b..e8e428ae 100644 --- a/SukiUI/Controls/SukiWindow.axaml +++ b/SukiUI/Controls/SukiWindow.axaml @@ -21,7 +21,8 @@ - + @@ -83,7 +88,7 @@ - + diff --git a/SukiUI/Theme/CheckBoxStyles.axaml b/SukiUI/Theme/CheckBoxStyles.axaml index 996fd507..e378a116 100644 --- a/SukiUI/Theme/CheckBoxStyles.axaml +++ b/SukiUI/Theme/CheckBoxStyles.axaml @@ -1,4 +1,5 @@ - + @@ -25,20 +26,14 @@ - - - - - - - + - + - - - + @@ -108,10 +95,7 @@ - - diff --git a/SukiUI/Theme/ComboBoxStyles.xaml b/SukiUI/Theme/ComboBoxStyles.xaml index 36598b47..7f059148 100644 --- a/SukiUI/Theme/ComboBoxStyles.xaml +++ b/SukiUI/Theme/ComboBoxStyles.xaml @@ -1,11 +1,13 @@  + xmlns:theme="clr-namespace:SukiUI.Theme" + xmlns:suki="https://github.com/kikipoulet/SukiUI"> - - + + + Item 1 Item 2 @@ -22,13 +24,13 @@ - - + - + @@ -138,7 +140,7 @@ - + @@ -188,10 +190,10 @@ - - diff --git a/SukiUI/Theme/DatePicker.axaml b/SukiUI/Theme/DatePicker.axaml index 33a93147..8893382f 100644 --- a/SukiUI/Theme/DatePicker.axaml +++ b/SukiUI/Theme/DatePicker.axaml @@ -1,7 +1,8 @@ + xmlns:sys="using:System" + xmlns:suki="https://github.com/kikipoulet/SukiUI"> - + @@ -48,14 +49,16 @@ - + xmlns:content="clr-namespace:SukiUI.Content" + xmlns:suki="https://github.com/kikipoulet/SukiUI"> @@ -14,17 +15,15 @@ - - + - + @@ -68,7 +67,7 @@ - + diff --git a/SukiUI/Theme/FlyoutPresenter.axaml b/SukiUI/Theme/FlyoutPresenter.axaml index f631a6d9..928f0525 100644 --- a/SukiUI/Theme/FlyoutPresenter.axaml +++ b/SukiUI/Theme/FlyoutPresenter.axaml @@ -10,7 +10,7 @@ - + + @@ -21,30 +20,30 @@ + CornerRadius="{TemplateBinding CornerRadius}" + RecognizesAccessKey="True" /> - + - + - - diff --git a/SukiUI/Theme/NumericUpDownStyles.xaml b/SukiUI/Theme/NumericUpDownStyles.xaml index 515cf367..72e5b3bb 100644 --- a/SukiUI/Theme/NumericUpDownStyles.xaml +++ b/SukiUI/Theme/NumericUpDownStyles.xaml @@ -1,22 +1,28 @@  + xmlns:theme="clr-namespace:SukiUI.Theme" + xmlns:suki="https://github.com/kikipoulet/SukiUI"> - + + + + diff --git a/SukiUI/Theme/ProgressBarStyles.xaml b/SukiUI/Theme/ProgressBarStyles.xaml index dbdfe063..99ce9a5f 100644 --- a/SukiUI/Theme/ProgressBarStyles.xaml +++ b/SukiUI/Theme/ProgressBarStyles.xaml @@ -1,7 +1,9 @@ - + - + @@ -16,7 +18,9 @@ - + + + - - + @@ -156,13 +160,13 @@ - - + + + + + diff --git a/SukiUI/Theme/SliderStyles.xaml b/SukiUI/Theme/SliderStyles.xaml index c8cea19d..a3c9b178 100644 --- a/SukiUI/Theme/SliderStyles.xaml +++ b/SukiUI/Theme/SliderStyles.xaml @@ -1,4 +1,6 @@ - + @@ -55,17 +57,19 @@ + + + - @@ -156,11 +160,7 @@ - + @@ -42,7 +42,24 @@ + + + + + + + diff --git a/SukiUI/Theme/TextBoxStyles.xaml b/SukiUI/Theme/TextBoxStyles.xaml index f87ae2db..88d08f2a 100644 --- a/SukiUI/Theme/TextBoxStyles.xaml +++ b/SukiUI/Theme/TextBoxStyles.xaml @@ -1,7 +1,9 @@  + xmlns:theme="clr-namespace:SukiUI.Theme" + xmlns:suki="https://github.com/kikipoulet/SukiUI" + xmlns:system="clr-namespace:System;assembly=netstandard"> - + @@ -221,9 +223,7 @@ - + - - @@ -490,17 +494,17 @@ - - - @@ -599,5 +603,20 @@ + + + + + + \ No newline at end of file diff --git a/SukiUI/Theme/TimePickerStyle.axaml b/SukiUI/Theme/TimePickerStyle.axaml index 6c67c0e6..f5cfd70d 100644 --- a/SukiUI/Theme/TimePickerStyle.axaml +++ b/SukiUI/Theme/TimePickerStyle.axaml @@ -2,7 +2,8 @@ + xmlns:sys="using:System" + xmlns:suki="https://github.com/kikipoulet/SukiUI"> @@ -12,7 +13,7 @@ - 40 + + - + - + - + @@ -348,5 +351,5 @@ - + --> \ No newline at end of file diff --git a/SukiUI/Theme/ToggleSwitchStyles.xaml b/SukiUI/Theme/ToggleSwitchStyles.xaml index 876b6383..a2f865fb 100644 --- a/SukiUI/Theme/ToggleSwitchStyles.xaml +++ b/SukiUI/Theme/ToggleSwitchStyles.xaml @@ -1,4 +1,6 @@ - + 0,0,0,6 6 @@ -29,7 +31,17 @@ - + + + + + + 0.4 + + + + + - + + + + - + @@ -90,15 +105,42 @@ + + + + + - + + + + + + + + + + + + + + + + + @@ -141,6 +183,8 @@ + + - - + --> + \ No newline at end of file diff --git a/SukiUI/Utilities/Effects/SukiEffect.cs b/SukiUI/Utilities/Effects/SukiEffect.cs index 3aef94ae..9f54eb50 100644 --- a/SukiUI/Utilities/Effects/SukiEffect.cs +++ b/SukiUI/Utilities/Effects/SukiEffect.cs @@ -125,6 +125,7 @@ public override bool Equals(object obj) } private static readonly float[] White = { 0.95f, 0.95f, 0.95f }; + internal SKShader ToShaderWithUniforms(float timeSeconds, ThemeVariant activeVariant, Rect bounds, float animationScale, float alpha = 1f)