From 7315805bfb16043efd986b24aa7b2fee6f5d2da9 Mon Sep 17 00:00:00 2001 From: Adrian Stevens Date: Tue, 6 Aug 2024 13:47:44 -0700 Subject: [PATCH] FromHsba fix + xml comments --- Source/Meadow.Contracts/Color.cs | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Source/Meadow.Contracts/Color.cs b/Source/Meadow.Contracts/Color.cs index d905b565..3e648452 100644 --- a/Source/Meadow.Contracts/Color.cs +++ b/Source/Meadow.Contracts/Color.cs @@ -67,7 +67,7 @@ public struct Color private float brightness; /// - /// Hue of current color (0-360.0) + /// Hue of current color (0-360) /// public float Hue { @@ -82,7 +82,7 @@ public float Hue } /// - /// Saturation of color (0-1.0) + /// Saturation of color (0-1) /// public float Saturation { @@ -97,7 +97,7 @@ public float Saturation } /// - /// Brightness of color (0-1.0) + /// Brightness of color (0-1) /// public float Brightness { @@ -114,10 +114,10 @@ public float Brightness /// /// Create a color struct /// - /// red component of color - /// green component of color - /// blue component of color - /// transparency of color + /// red component of color (0-255) + /// green component of color (0-255) + /// blue component of color (0-255) + /// transparency of color (0-255) public Color(byte red, byte green, byte blue, byte alpha = 255) { R = red; @@ -131,9 +131,9 @@ public Color(byte red, byte green, byte blue, byte alpha = 255) /// /// Create a color struct - convenience ctor for floats - prefer byte version /// - /// red component of color - /// green component of color - /// blue component of color + /// red component of color (0-1) + /// green component of color (0-1) + /// blue component of color (0-1) public Color(float red, float green, float blue) : this((byte)(red * 255), (byte)(green * 255), (byte)(blue * 255), 255) { @@ -142,10 +142,10 @@ public Color(float red, float green, float blue) : /// /// Create a color struct /// - /// hue of color - /// saturation of color - /// brightness of color - /// alpha (transparency) of color + /// hue of color (0-1) + /// saturation of color (0-1) + /// brightness of color (0-1) + /// alpha (transparency) of color (0-255) public Color(float hue, float saturation, float brightness, byte alpha = 255) { HslToRgb(hue * 360, saturation, brightness, out float red, out float green, out float blue); @@ -163,7 +163,7 @@ public Color(float hue, float saturation, float brightness, byte alpha = 255) /// /// Create a new color struct from current color with new brightness /// - /// brightness of new color (0-1.0) + /// brightness of new color (0-1) /// new color object public Color WithBrightness(float brightness) { @@ -173,7 +173,7 @@ public Color WithBrightness(float brightness) /// /// Create a new color struct from current color with new hue /// - /// hue of new color (0-360.0) + /// hue of new color (0-360) /// new color object public Color WithHue(float hue) { @@ -183,7 +183,7 @@ public Color WithHue(float hue) /// /// Create a new color structs from current color with new saturation /// - /// saturation of new color (0-1.0) + /// saturation of new color (0-1) /// new color object public Color WithSaturation(float saturation) { @@ -449,14 +449,14 @@ public static Color FromRgb(float r, float g, float b) /// new color object public static Color FromHsba(float h, float s, float b, float a = 1.0f) { - return new Color(h, s, b, (byte)(a * 255)); + return new Color(h / 360f, s, b, (byte)(a * 255)); } /// /// Takes Hue, Saturation and Value and returns a Color object /// - /// - /// + /// alpha of color (0-1) + /// hue of color (0-360) /// /// /// A Color object @@ -470,7 +470,7 @@ public static Color FromAhsv(float alpha, float hue, float saturation, float val /// /// HSL to RGB /// - /// Hue in degrees (0-359°) + /// Hue in degrees (0-360) /// Saturation /// Brightness value /// The red component (0-1) @@ -557,9 +557,9 @@ public static void HslToRgb(float hue, float saturation, float lightness, out fl /// /// HSV to RGB /// - /// Hue in degrees (0-359°) - /// Saturation - /// Brightness value + /// Hue in degrees (0-360) + /// Saturation (0-1) + /// Brightness (0-1) /// The red component (0-1) /// The green component (0-1) /// The blue component (0-1)