Skip to content

Commit 258687f

Browse files
Selection background color changing with respecting pixel colors (#227)
1 parent b632425 commit 258687f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Pixed.Application/Controls/SelectionOverlay.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,16 @@ private static void DrawSelectionBackground(SKCanvas canvas, BaseSelection selec
9292
{
9393
var pixel = pixels[i];
9494

95-
var color = new UniColor(128, 12, 84, 139);
95+
var color = (UniColor)pixel.Color;
9696
var hsl = color.ToHsl();
97-
color = pixel.Color;
98-
9997
if (hsl.L < 0.5d)
10098
{
101-
color = color.Darken(10);
99+
color = new UniColor(128, UniColor.White);
102100

103101
}
104102
else
105103
{
106-
color = color.Lighten(10);
104+
color = new UniColor(128, UniColor.Black);
107105
}
108106

109107
color.A = 128;

Pixed.Core/UniColor.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public UniColor() : this(0, 0, 0, 0)
3232
public UniColor(byte alpha, byte value) : this(alpha, value, value, value)
3333
{ }
3434

35+
public UniColor(byte alpha, UniColor color) : this(alpha, color.R, color.G, color.B)
36+
{ }
37+
3538
public UniColor(byte value) : this(255, value)
3639
{ }
3740

0 commit comments

Comments
 (0)