From dd12312b58ca9dd7a2fd0e61aa9c800f30346881 Mon Sep 17 00:00:00 2001 From: Gael-de-Sailly Date: Fri, 27 Feb 2015 20:51:55 +0100 Subject: [PATCH] Add minetest.rgba function that returns ColorString from RGBA or RGB values --- builtin/common/misc_helpers.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index f9b572d..776be29 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -511,6 +511,12 @@ function core.explode_scrollbar_event(evt) return retval end +-------------------------------------------------------------------------------- +function core.rgba(r, g, b, a) + return a and string.format("#%02X%02X%02X%02X", r, g, b, a) or + string.format("#%02X%02X%02X", r, g, b) +end + -------------------------------------------------------------------------------- function core.pos_to_string(pos, decimal_places) local x = pos.x