diff options
author | Gael-de-Sailly <gael.chretien@akeonet.com> | 2015-02-27 20:51:55 +0100 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2017-06-22 03:11:50 +0100 |
commit | bc53c82bcf923d11725e3de8565eb4c7e435cd2b (patch) | |
tree | 9766b64f87b569033291ebb799c26d68512c074c /builtin/common/misc_helpers.lua | |
parent | 1425c6def156840b359b90b4f32b9c7b8f005731 (diff) | |
download | minetest-bc53c82bcf923d11725e3de8565eb4c7e435cd2b.tar.gz minetest-bc53c82bcf923d11725e3de8565eb4c7e435cd2b.tar.bz2 minetest-bc53c82bcf923d11725e3de8565eb4c7e435cd2b.zip |
Add minetest.rgba function that returns ColorString from RGBA or RGB values
Diffstat (limited to 'builtin/common/misc_helpers.lua')
-rw-r--r-- | builtin/common/misc_helpers.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua index f9b572d9f..776be29d8 100644 --- a/builtin/common/misc_helpers.lua +++ b/builtin/common/misc_helpers.lua @@ -512,6 +512,12 @@ function core.explode_scrollbar_event(evt) 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 local y = pos.y |