-
-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Labels
Milestone
Description
Currently, when UseHex is true, color values are output as hex only if alpha is 1.0.
AngleSharp.Css/src/AngleSharp.Css/Values/Primitives/Color.cs
Lines 376 to 381 in 15deaee
| /// <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; } |
AngleSharp.Css/src/AngleSharp.Css/Values/Primitives/Color.cs
Lines 398 to 401 in 15deaee
| 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.