mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
LibWeb: Limit color alpha values to 4 decimal places when serializing
The spec explicitly mentions that these values need to round-trip, and 4 decimal places is enough for 8-bit values
This commit is contained in:
parent
0487485fb1
commit
da18957063
1 changed files with 1 additions and 1 deletions
|
@ -144,7 +144,7 @@ void serialize_a_srgb_value(StringBuilder& builder, Color color)
|
|||
if (color.alpha() == 255)
|
||||
builder.appendff("rgb({}, {}, {})"sv, color.red(), color.green(), color.blue());
|
||||
else
|
||||
builder.appendff("rgba({}, {}, {}, {})"sv, color.red(), color.green(), color.blue(), (float)(color.alpha()) / 255.0f);
|
||||
builder.appendff("rgba({}, {}, {}, {:.4})"sv, color.red(), color.green(), color.blue(), (float)(color.alpha()) / 255.0f);
|
||||
}
|
||||
|
||||
String escape_a_character(u32 character)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue