From: Christian Heller Date: Tue, 1 Dec 2020 05:37:47 +0000 (+0100) Subject: Fix color setting bug. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bprefix%7D%7D/todo?a=commitdiff_plain;h=c0aba691859793c07e9d17c7494af36013f046c0;p=plomrogue2 Fix color setting bug. --- diff --git a/rogue_chat.html b/rogue_chat.html index 17747ff..0a70962 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -286,7 +286,7 @@ let terminal = { }, set_random_colors: function() { function rand(offset) { - return Math.floor(offset + Math.random() * 96).toString(16); + return Math.floor(offset + Math.random() * 96).toString(16).padStart(2, '0'); } this.foreground = '#' + rand(159) + rand(159) + rand(159); this.background = '#' + rand(0) + rand(0) + rand(0);