Browse Source

Filter out transparent colors

Krzysztof Krysiński 3 years ago
parent
commit
cfd2ce01aa
1 changed files with 3 additions and 1 deletions
  1. 3 1
      PixiEditor/Views/UserControls/Palettes/PaletteColorAdder.xaml.cs

+ 3 - 1
PixiEditor/Views/UserControls/Palettes/PaletteColorAdder.xaml.cs

@@ -113,7 +113,7 @@ namespace PixiEditor.Views.UserControls.Palettes
 
         private void UpdateAddSwatchesButton()
         {
-            AddFromSwatches.IsEnabled = Swatches != null && Swatches.Any(x => !Colors.Contains(x));
+            AddFromSwatches.IsEnabled = Swatches != null && Swatches.Where(x => x.Alpha == 255).Any(x => !Colors.Contains(x));
         }
 
         public PaletteColorAdder()
@@ -142,6 +142,8 @@ namespace PixiEditor.Views.UserControls.Palettes
 
             foreach (var color in Swatches)
             {
+                if(color.Alpha < 255) continue; // No alpha support for now, palette colors shouldn't be transparent
+                
                 if (!Colors.Contains(color))
                 {
                     Colors.Add(color);