First Upload
commit
cfd82259c1
|
@ -0,0 +1,24 @@
|
|||
MIT License
|
||||
===========
|
||||
|
||||
|
||||
Copyright (c) 2021 xenonca
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Colorize
|
||||
|
||||
## Description
|
||||
Let's you colorize messages using HEX color codes (for testing purposes).
|
||||
|
||||
## Usage
|
||||
Use `/c <HEX-code> <message>` to return a message colorized in your specified color.
|
||||
Use `/ca <HEX-code> <message>` to send a message colorized in your specified color to the public chat.
|
||||
|
||||
## Dependencies
|
||||
--------------
|
||||
none
|
||||
|
||||
## License
|
||||
---------
|
||||
MIT by xenonca
|
||||
|
||||
[![ContentDB](https://content.minetest.net/packages/_Xenon/colorize/shields/title/)](https://content.minetest.net/packages/_Xenon/colorize/)
|
|
@ -0,0 +1,54 @@
|
|||
minetest.register_privilege("colorize", {
|
||||
description = "Colorize messages with HEX codes",
|
||||
give_to_singleplayer = false
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("c", {
|
||||
params = "<color> <msg>",
|
||||
privs = {colorize = true},
|
||||
description = "Return colorized message | Example: /c FF9900 Hello",
|
||||
func = function(name, param)
|
||||
if not param or param:trim() == "" then
|
||||
return false, "Please enter a message!"
|
||||
end
|
||||
|
||||
local args = param:split(" ")
|
||||
if #args < 2 then
|
||||
return true, minetest.chat_send_player(name, "Please enter a HEX code!")
|
||||
end
|
||||
|
||||
if args[1]:len() ~= 6 or not args[1]:match("[%dabcdefABCDEF]") then
|
||||
return false, "Invalid HEX code. (Do not inclue '#' in your message)"
|
||||
end
|
||||
|
||||
local color = tostring(args[1])
|
||||
table.remove(args, 1)
|
||||
local msg = table.concat(args, " ")
|
||||
minetest.chat_send_player(name, minetest.colorize("#" .. color, msg))
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("ca", {
|
||||
params = "<color> <msg>",
|
||||
privs = {colorize = true},
|
||||
description = "Send colorized message | Example: /ca FF9900 Hello",
|
||||
func = function(name, param)
|
||||
if not param or param:trim() == "" then
|
||||
return false, "Please enter a message!"
|
||||
end
|
||||
|
||||
local args = param:split(" ")
|
||||
if #args < 2 then
|
||||
return true, minetest.chat_send_player(name, "Please enter a HEX code!")
|
||||
end
|
||||
|
||||
if args[1]:len() ~= 6 or not args[1]:match("[%dabcdefABCDEF]") then
|
||||
return false, "Invalid HEX code. (Do not inclue '#' in your message)"
|
||||
end
|
||||
|
||||
local color = tostring(args[1])
|
||||
table.remove(args, 1)
|
||||
local msg = table.concat(args, " ")
|
||||
minetest.chat_send_all(minetest.colorize("#" .. color, msg))
|
||||
end
|
||||
})
|
|
@ -0,0 +1,4 @@
|
|||
name = colorize
|
||||
author = xenonca
|
||||
description = Let's you colorize your messages using HEX color codes (for testing purposes).
|
||||
title = Colorize
|
Binary file not shown.
After Width: | Height: | Size: 9.9 KiB |
Loading…
Reference in New Issue