From 4c3b07db1ee4ef3ad92a9653a3015aa27baf0e02 Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Wed, 18 Sep 2024 11:34:01 +0200 Subject: [PATCH] qa: Fix team color --- qa/ui/src/lib/teams.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qa/ui/src/lib/teams.js b/qa/ui/src/lib/teams.js index c39c2409..2db94a36 100644 --- a/qa/ui/src/lib/teams.js +++ b/qa/ui/src/lib/teams.js @@ -22,11 +22,14 @@ export class Team { toHexColor() { let num = this.color; num >>>= 0; - let b = num & 0xFF, - g = (num & 0xFF00) >>> 8, - r = (num & 0xFF0000) >>> 16, + let b = (num & 0xFF).toString(16), + g = ((num & 0xFF00) >>> 8).toString(16), + r = ((num & 0xFF0000) >>> 16).toString(16), a = ( (num & 0xFF000000) >>> 24 ) / 255 ; - return "#" + r.toString(16) + g.toString(16) + b.toString(16); + if (r.length <= 1) r = "0" + r; + if (g.length <= 1) g = "0" + g; + if (b.length <= 1) b = "0" + b; + return "#" + r + g + b; } }