diff --git a/src/ImageSharp/Color/Color.cs b/src/ImageSharp/Color/Color.cs index 13af25f6c..cebceabe0 100644 --- a/src/ImageSharp/Color/Color.cs +++ b/src/ImageSharp/Color/Color.cs @@ -251,7 +251,17 @@ public readonly partial struct Color : IEquatable /// /// A hexadecimal string representation of the value. [MethodImpl(InliningOptions.ShortMethod)] - public string ToHex() => this.data.ToRgba32().ToHex(); + public string ToHex() + { + if (this.boxedHighPrecisionPixel is not null) + { + Rgba32 rgba = default; + this.boxedHighPrecisionPixel.ToRgba32(ref rgba); + return rgba.ToHex(); + } + + return this.data.ToRgba32().ToHex(); + } /// public override string ToString() => this.ToHex();