Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry Ewing <lewing@microsoft.com>2018-07-16 22:51:55 +0300
committerLarry Ewing <lewing@microsoft.com>2018-07-16 22:51:55 +0300
commit17f46bfd8a4572382a2efd04d155efbcc093104b (patch)
treed70601d570c194eabe9c5e1cc822c964cacafa77 /Xamarin.PropertyEditing.Mac/Controls/Custom
parent36c3dbfc972a7c9d8ed0cc779011816f0a872ebb (diff)
[mac] Update default checkerboard vaues based on theme
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom')
-rw-r--r--Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs19
1 files changed, 16 insertions, 3 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs
index 1137072..6bb5c15 100644
--- a/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs
+++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/DrawingExtensions.cs
@@ -10,8 +10,12 @@ namespace Xamarin.PropertyEditing.Mac
{
public static NSImage CreateSwatch (this CommonColor color, CGSize size)
{
- var c0 = CIColor.FromCGColor (color.Blend (CommonColor.White).ToCGColor ());
- var c1 = CIColor.FromCGColor (color.Blend (CommonColor.Black).ToCGColor ());
+ bool dark = PropertyEditorPanel.ThemeManager.Theme == Themes.PropertyEditorTheme.Dark;
+ byte c0c = (byte)(dark ? 0x26: 0xff);
+ byte c1c = (byte)(dark ? 0x00 : 0xd9);
+
+ var c0 = CIColor.FromCGColor (color.Blend (new CommonColor (c0c, c0c, c0c)).ToCGColor ());
+ var c1 = CIColor.FromCGColor (color.Blend (new CommonColor (c1c, c1c, c1c)).ToCGColor ());
return CreateSwatch (color, size, c0, c1);
}
@@ -20,7 +24,16 @@ namespace Xamarin.PropertyEditing.Mac
=> new NSImage (GenerateCheckerboard (new CGRect (0, 0, size.Width, size.Height), c0, c1), size);
public static CGImage GenerateCheckerboard (CGRect frame)
- => GenerateCheckerboard (frame, CIColor.WhiteColor, CIColor.BlackColor);
+ {
+ bool dark = PropertyEditorPanel.ThemeManager.Theme == Themes.PropertyEditorTheme.Dark;
+ float c1 = dark ? 0x26 / 255f : 1;
+ float c2 = dark ? 0 : 0xd9 / 255f;
+
+ return DrawingExtensions.GenerateCheckerboard (
+ frame,
+ CoreImage.CIColor.FromRgb (c1, c1, c1),
+ CoreImage.CIColor.FromRgb (c2, c2, c2));
+ }
public static CGImage GenerateCheckerboard (CGRect frame, CIColor c0, CIColor c1)
{