From a449a982b44f748de3fbfdb668ab10da425401ed Mon Sep 17 00:00:00 2001 From: boxgaming <75969133+boxgaming@users.noreply.github.com> Date: Tue, 26 Apr 2022 10:28:01 -0500 Subject: [PATCH] Added support for RGB colors defined with number literals --- qb.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qb.js b/qb.js index 46893aa..c3e9275 100644 --- a/qb.js +++ b/qb.js @@ -563,7 +563,15 @@ var QB = new function() { else if (!isNaN(c) && c >= 0 && c <= 255) { return _colormap[parseInt(c)]; } - return QB.func__RGB(0,0,0); + else if (!isNaN(c) && c > 255) { + var hexstr = QB.func_Right('00000000' + c.toString(16), 8); + var a = hexstr.slice(0, 2); + var r = hexstr.slice(2, 4); + var g = hexstr.slice(4, 6); + var b = hexstr.slice(6, 8); + return _rgb(parseInt(r, 16), parseInt(g, 16), parseInt(b, 16), parseInt(a, 16)/255); + } + return _rgb(0,0,0); } this.sub_Color = function(fg, bg) {