ladybird/Tests/LibWeb/Text/input/canvas/fillStyle-serialization.html
Andreas Kling 4590c081c2 LibWeb+LibGfx: Serialize HTML canvas fill/strokeStyle colors correctly
Before this change we were serializing them in a bogus 8-digit hex color
format that isn't actually recognized by HTML.

This code will need more work when we start supporting color spaces
other than sRGB.
2024-10-04 20:01:22 +02:00

18 lines
474 B
HTML

<script src="../include.js"></script>
<canvas id="c" width=300 height=300></canvas>
<script>
test(() => {
let x = c.getContext("2d");
function go(color) {
x.fillStyle = color;
println("`" + color + "` -> `" + x.fillStyle + "`");
}
go("green");
go("rgba(128, 128, 128, 0.4)");
go("rgba(128, 128, 128, 0)");
go("rgba(128, 128, 128, 1)");
go("rgb(128, 128, 128)");
});
</script>