From 8121bc0dd2db606dd52cc87dc81c838a7ad45613 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sun, 29 Mar 2026 12:13:59 +0200 Subject: [PATCH] Remove a tiny bit of unnecessary "rgba" parsing in the `getRGB` function This obviously won't matter in practice, however it seems more "correct" to only extract the necessary number of color components rather than slicing off excess ones at the end. --- src/display/display_utils.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/display/display_utils.js b/src/display/display_utils.js index 3cf8e7b6f..711ecae6c 100644 --- a/src/display/display_utils.js +++ b/src/display/display_utils.js @@ -604,9 +604,8 @@ function getRGB(color) { if (color.startsWith("rgba(")) { return color .slice(/* "rgba(".length */ 5, -1) // Strip out "rgba(" and ")". - .split(",") - .map(x => parseInt(x)) - .slice(0, 3); + .split(",", 3) + .map(x => parseInt(x)); } warn(`Not a valid color format: "${color}"`);