News for hackers. Stuff that matters.
Re:It's always been you, Canvas2D by agys on Friday March 04, 2022 @11:24AM (#30556821)
A very annoying part of the Canvas API is that colors are represented as (CSS) strings, except for the pixel array, obviously. This forces to write code like this:

  const fillColor = `rgb(${r},${g},${b})`
For the rest: long live the Canvas! <3
Re:It's always been you, Canvas2D by hmry on Friday March 04, 2022 @10:25PM (#30563913)
Fun tip: If you have an array of RGB you can shorten that somewhat

  const color = [254, 134, 29];
  ctx.fillStyle = `rgb(${color})`;
  ctx.fillStyle = `rgba(${color},0.5)`; // I use this one pretty often
Re:It's always been you, Canvas2D by mysteryDate on Friday March 04, 2022 @02:24PM (#30559188)
TypedOM CSSColor is coming soon!