diff --git a/src/Avalonia.Visuals/Media/Color.cs b/src/Avalonia.Visuals/Media/Color.cs
index aa730b3219..9f8588d400 100644
--- a/src/Avalonia.Visuals/Media/Color.cs
+++ b/src/Avalonia.Visuals/Media/Color.cs
@@ -278,7 +278,7 @@ namespace Avalonia.Media
/// The HSV equivalent color.
public HsvColor ToHsv()
{
- // Use the by-channel conversion method directly for performance
+ // Use the by-component conversion method directly for performance
// Don't use the HsvColor(Color) constructor to avoid an extra HsvColor
return HsvColor.FromRgb(R, G, B, A);
}
@@ -289,11 +289,13 @@ namespace Avalonia.Media
return A == other.A && R == other.R && G == other.G && B == other.B;
}
+ ///
public override bool Equals(object? obj)
{
return obj is Color other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
diff --git a/src/Avalonia.Visuals/Media/HsvColor.cs b/src/Avalonia.Visuals/Media/HsvColor.cs
index 25180e550d..c58db9df00 100644
--- a/src/Avalonia.Visuals/Media/HsvColor.cs
+++ b/src/Avalonia.Visuals/Media/HsvColor.cs
@@ -309,6 +309,22 @@ namespace Avalonia.Media
return new HsvColor(a, h, s, v);
}
+ ///
+ /// Creates a new from individual color component values.
+ ///
+ ///
+ /// This exists for symmetry with the struct; however, the
+ /// appropriate constructor should commonly be used instead.
+ ///
+ /// The Hue component in the range from 0..360.
+ /// The Saturation component in the range from 0..1.
+ /// The Value component in the range from 0..1.
+ /// A new built from the individual color component values.
+ public static HsvColor FromHsv(double h, double s, double v)
+ {
+ return new HsvColor(1.0, h, s, v);
+ }
+
///
/// Converts the given HSV color to it's RGB color equivalent.
///