From 9bcd98a48a96a807c3e3b5fed5513f0b3e1c06a9 Mon Sep 17 00:00:00 2001 From: tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Sun, 19 Apr 2026 19:42:37 +0300 Subject: [PATCH 1/2] Add `Color.WithFullAlpha()` extension --- PowerKit.Tests/Extensions/ColorExtensionsTests.cs | 10 ++++++++++ PowerKit/Extensions/ColorExtensions.cs | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/PowerKit.Tests/Extensions/ColorExtensionsTests.cs b/PowerKit.Tests/Extensions/ColorExtensionsTests.cs index 90b43c3..0d1871e 100644 --- a/PowerKit.Tests/Extensions/ColorExtensionsTests.cs +++ b/PowerKit.Tests/Extensions/ColorExtensionsTests.cs @@ -37,4 +37,14 @@ public void WithAlpha_Test() Color.FromArgb(255, 0x12, 0x34, 0x56).WithAlpha(128).B.Should().Be(0x56); Color.FromArgb(0, 0xff, 0xff, 0xff).WithAlpha(255).A.Should().Be(255); } + + [Fact] + public void WithFullAlpha_Test() + { + // Act & assert + Color.FromArgb(0, 0x12, 0x34, 0x56).WithFullAlpha().A.Should().Be(255); + Color.FromArgb(0, 0x12, 0x34, 0x56).WithFullAlpha().R.Should().Be(0x12); + Color.FromArgb(0, 0x12, 0x34, 0x56).WithFullAlpha().G.Should().Be(0x34); + Color.FromArgb(0, 0x12, 0x34, 0x56).WithFullAlpha().B.Should().Be(0x56); + } } diff --git a/PowerKit/Extensions/ColorExtensions.cs b/PowerKit/Extensions/ColorExtensions.cs index 83d7c3a..37cffa9 100644 --- a/PowerKit/Extensions/ColorExtensions.cs +++ b/PowerKit/Extensions/ColorExtensions.cs @@ -25,5 +25,10 @@ internal static class ColorExtensions /// Returns a new with the specified alpha value. /// public Color WithAlpha(int alpha) => Color.FromArgb(alpha, color); + + /// + /// Returns a new with a full alpha channel. + /// + public Color WithFullAlpha() => color.WithAlpha(255); } } From d8d7466b40a165afe5e930efd906cd1d542cda35 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Sun, 19 Apr 2026 19:44:41 +0300 Subject: [PATCH 2/2] Update PowerKit/Extensions/ColorExtensions.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- PowerKit/Extensions/ColorExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PowerKit/Extensions/ColorExtensions.cs b/PowerKit/Extensions/ColorExtensions.cs index 37cffa9..321a7bf 100644 --- a/PowerKit/Extensions/ColorExtensions.cs +++ b/PowerKit/Extensions/ColorExtensions.cs @@ -27,7 +27,7 @@ internal static class ColorExtensions public Color WithAlpha(int alpha) => Color.FromArgb(alpha, color); /// - /// Returns a new with a full alpha channel. + /// Returns a new with its alpha component set to 255 (fully opaque). /// public Color WithFullAlpha() => color.WithAlpha(255); }