add `mcl_test_colors`

This commit is contained in:
AFCMS 2022-03-25 15:37:51 +01:00
parent 578fe31687
commit 967dac3bda
Signed by: AFCMS
GPG Key ID: 8720389A25B652E3
2 changed files with 44 additions and 0 deletions

41
mcl_test_colors/init.lua Normal file
View File

@ -0,0 +1,41 @@
local C = minetest.colorize
local formspec = table.concat({
"formspec_version[4]",
"size[9,9.5]",
"style_type[label;font_size=25;font=bold]",
})
local colors = {
"BLACK",
"DARK_BLUE",
"DARK_GREEN",
"DARK_AQUA",
"DARK_RED",
"DARK_PURPLE",
"GOLD",
"GRAY",
"DARK_GRAY",
"BLUE",
"GREEN",
"AQUA",
"RED",
"LIGHT_PURPLE",
"YELLOW",
"WHITE",
}
local count = 0
for _,name in pairs(colors) do
count = count + 1
formspec = formspec..
"label[0.4,".. 0.4 + 0.5 * count..";"..C(mcl_colors[name], "mcl_colors."..name).."]"..
"box[6,".. 0.2 + 0.5 * count..";2.5,0.5;"..mcl_colors.background[name].."]"
end
minetest.register_chatcommand("colors", {
description = "Show a formspec featuring all color in mcl_colors",
func = function(playername)
minetest.show_formspec(playername, "mcl_test_colors:colors", formspec)
end,
})

3
mcl_test_colors/mod.conf Normal file
View File

@ -0,0 +1,3 @@
name = mcl_test_colors
author = AFCMS
depends = mcl_colors