1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2024-09-20 04:24:45 +00:00

Added support for RGB colors defined with number literals

This commit is contained in:
boxgaming 2022-04-26 10:28:01 -05:00
parent 8234492c12
commit a449a982b4

10
qb.js
View file

@ -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) {