Automattic/node-canvas

fillStyle and strokeStyle fail when using fractional values on rgba

Open

#1.787 geöffnet am 19. Apr. 2021

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (1.140 Forks)batch import
BugGood first issue

Repository-Metriken

Stars
 (9.524 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 34T 18h) (2 gemergte PRs in 30 T)

Beschreibung

Issue or Feature

Whenever you try to set a color style with fractional components like 'rgba(120.1, 120.2, 120.3, 1)', it fails to parse and defaults to a black color.

Steps to Reproduce

var Canvas = require('canvas');
var canvas = Canvas.createCanvas(200, 200);
var ctx = canvas.getContext('2d');
ctx.fillStyle = 'rgba(240.2,0,0,1)';
ctx.fillRect(20, 20, 40, 40);

Shows a black rectangle instead of a red one.

Your Environment

node-canvas 2.7.0 Node is v12.16.1 on OS X Catalina 10.15.7

Contributor Guide