Language

Color Class

Definition

Represents an RGBA color with floating-point components in the range of 0.0 to 1.0.

public ref class Color
public ref class Color sealed : IEquatable<Microsoft::Maui::Graphics::Color ^>
[System.ComponentModel.TypeConverter(typeof(Microsoft.Maui.Graphics.Converters.ColorTypeConverter))]
public class Color
[System.ComponentModel.TypeConverter(typeof(Microsoft.Maui.Graphics.Converters.ColorTypeConverter))]
public sealed class Color : IEquatable<Microsoft.Maui.Graphics.Color>
[<System.ComponentModel.TypeConverter(typeof(Microsoft.Maui.Graphics.Converters.ColorTypeConverter))>]
type Color = class
[<System.ComponentModel.TypeConverter(typeof(Microsoft.Maui.Graphics.Converters.ColorTypeConverter))>]
type Color = class
    interface IEquatable<Color>
Public Class Color
Public NotInheritable Class Color
Implements IEquatable(Of Color)
Inheritance
Color
Attributes
Implements

Remarks

Color is a sealed record type, so equality (via Equals(Color), ==, and !=) is always value-based, comparing the underlying ARGB representation regardless of how the instance was created. Sealing prevents subclassing, which guarantees this value-based equality can never be silently broken by a derived type.

Constructors

Name Description
Color()

Initializes a new instance of the Color class with default values (black).

Color(Byte, Byte, Byte, Byte)
Color(Byte, Byte, Byte)
Color(Int32, Int32, Int32, Int32)
Color(Int32, Int32, Int32)
Color(Single, Single, Single, Single)
Color(Single, Single, Single)
Color(Single)
Color(Vector4)

Fields

Name Description
Alpha

The alpha (opacity) component of the color, ranging from 0.0 (transparent) to 1.0 (opaque).

Blue

The blue component of the color, ranging from 0.0 to 1.0.

Green

The green component of the color, ranging from 0.0 to 1.0.

Red

The red component of the color, ranging from 0.0 to 1.0.

Methods

Name Description
<Clone>$()
AddLuminosity(Single)
AsPaint()
Equals(Color)

Determines whether the specified Color is equal to the current color using byte-precision comparison.

Equals(Object)
FromArgb(String)
FromHex(String)
FromHsla(Double, Double, Double, Double)
FromHsla(Single, Single, Single, Single)
FromHsv(Int32, Int32, Int32)
FromHsv(Single, Single, Single)
FromHsva(Int32, Int32, Int32, Int32)
FromHsva(Single, Single, Single, Single)
FromInt(Int32)
FromRgb(Byte, Byte, Byte)
FromRgb(Double, Double, Double)
FromRgb(Int32, Int32, Int32)
FromRgb(Single, Single, Single)
FromRgba(Byte, Byte, Byte, Byte)
FromRgba(Double, Double, Double, Double)
FromRgba(Int32, Int32, Int32, Int32)
FromRgba(Single, Single, Single, Single)
FromRgba(String)
FromUint(UInt32)
GetComplementary()
GetHashCode()
GetHue()
GetLuminosity()
GetSaturation()
MultiplyAlpha(Single)
Parse(String)
ToArgbHex(Boolean)
ToHex()
ToHex(Boolean)
ToHsl(Single, Single, Single)
ToInt()
ToRgb(Byte, Byte, Byte)
ToRgba(Byte, Byte, Byte, Byte)
ToRgbaHex(Boolean)
ToString()
ToUint()
TryParse(String, Color)
WithAlpha(Single)
WithHue(Single)
WithLuminosity(Single)
WithSaturation(Single)

Operators

Name Description
Equality(Color, Color)
Implicit(Vector4 to Color)
Inequality(Color, Color)

Extension Methods

Name Description
AsSKColor(Color)

Converts a .NET MAUI Graphics color to a SkiaSharp color.

AsSKColorMultiplyAlpha(Color, Single)

Converts a .NET MAUI Graphics color to a SkiaSharp color with a multiplied alpha value.

IsDefault(Color)
IsNotDefault(Color)
Lerp(Color, Color, Double)
ToArgb(Color, Single)

Converts a .NET MAUI Graphics color to an ARGB integer representation with a modified alpha value.

ToArgb(Color)

Converts a .NET MAUI Graphics color to an ARGB integer representation.

ToColor(Color, Single)

Converts a .NET MAUI Graphics color to a SkiaSharp color.

Applies to