Skip to content

Output hex color value for transparent values if UseHex is true #132

Closed
@mganss

Description

@mganss

Currently, when UseHex is true, color values are output as hex only if alpha is 1.0.

/// <summary>
/// Gets or sets if hex codes should be used for serialization.
/// This will not be applied in case of transparent colors, i.e.,
/// when alpha is not 1.
/// </summary>
public static Boolean UseHex { get; set; }

else if (_alpha == 255 && UseHex)
{
return $"#{_red.ToString("X2", CultureInfo.InvariantCulture)}{_green.ToString("X2", CultureInfo.InvariantCulture)}{_blue.ToString("X2", CultureInfo.InvariantCulture)}";
}

Perhaps this could be changed to include colors with alpha < 1.0, too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions