diff options
-rw-r--r-- | init.lua | 179 |
1 files changed, 177 insertions, 2 deletions
@@ -1,8 +1,183 @@ local modstorage = core.get_mod_storage() -local modpath = minetest.get_modpath("colour_chat") +-- crashed on pre-5.2 +-- local modpath = minetest.get_modpath("colour_chat") +-- dofile(modpath .. "/colournames.lua") + +-- This list of colour names was extracted and converted from +-- https://drafts.csswg.org/css-color/#named-colors + + +local colournames = {} + +colournames["aliceblue"] = "#F0F8FF" +colournames["antiquewhite"] = "#FAEBD7" +colournames["aqua"] = "#00FFFF" +colournames["aquamarine"] = "#7FFFD4" +colournames["azure"] = "#F0FFFF" +colournames["beige"] = "#F5F5DC" +colournames["bisque"] = "#FFE4C4" +colournames["black"] = "#000000" +colournames["blanchedalmond"] = "#FFEBCD" +colournames["blue"] = "#0000FF" +colournames["blueviolet"] = "#8A2BE2" +colournames["brown"] = "#A52A2A" +colournames["burlywood"] = "#DEB887" +colournames["cadetblue"] = "#5F9EA0" +colournames["chartreuse"] = "#7FFF00" +colournames["chocolate"] = "#D2691E" +colournames["coral"] = "#FF7F50" +colournames["cornflowerblue"] = "#6495ED" +colournames["cornsilk"] = "#FFF8DC" +colournames["crimson"] = "#DC143C" +colournames["cyan"] = "#00FFFF" +colournames["darkblue"] = "#00008B" +colournames["darkcyan"] = "#008B8B" +colournames["darkgoldenrod"] = "#B8860B" +colournames["darkgray"] = "#A9A9A9" +colournames["darkgreen"] = "#006400" +colournames["darkgrey"] = "#A9A9A9" +colournames["darkkhaki"] = "#BDB76B" +colournames["darkmagenta"] = "#8B008B" +colournames["darkolivegreen"] = "#556B2F" +colournames["darkorange"] = "#FF8C00" +colournames["darkorchid"] = "#9932CC" +colournames["darkred"] = "#8B0000" +colournames["darksalmon"] = "#E9967A" +colournames["darkseagreen"] = "#8FBC8F" +colournames["darkslateblue"] = "#483D8B" +colournames["darkslategray"] = "#2F4F4F" +colournames["darkslategrey"] = "#2F4F4F" +colournames["darkturquoise"] = "#00CED1" +colournames["darkviolet"] = "#9400D3" +colournames["deeppink"] = "#FF1493" +colournames["deepskyblue"] = "#00BFFF" +colournames["dimgray"] = "#696969" +colournames["dimgrey"] = "#696969" +colournames["dodgerblue"] = "#1E90FF" +colournames["firebrick"] = "#B22222" +colournames["floralwhite"] = "#FFFAF0" +colournames["forestgreen"] = "#228B22" +colournames["fuchsia"] = "#FF00FF" +colournames["gainsboro"] = "#DCDCDC" +colournames["ghostwhite"] = "#F8F8FF" +colournames["gold"] = "#FFD700" +colournames["goldenrod"] = "#DAA520" +colournames["gray"] = "#808080" +colournames["green"] = "#008000" +colournames["greenyellow"] = "#ADFF2F" +colournames["grey"] = "#808080" +colournames["honeydew"] = "#F0FFF0" +colournames["hotpink"] = "#FF69B4" +colournames["indianred"] = "#CD5C5C" +colournames["indigo"] = "#4B0082" +colournames["ivory"] = "#FFFFF0" +colournames["khaki"] = "#F0E68C" +colournames["lavender"] = "#E6E6FA" +colournames["lavenderblush"] = "#FFF0F5" +colournames["lawngreen"] = "#7CFC00" +colournames["lemonchiffon"] = "#FFFACD" +colournames["lightblue"] = "#ADD8E6" +colournames["lightcoral"] = "#F08080" +colournames["lightcyan"] = "#E0FFFF" +colournames["lightgoldenrodyellow"] = "#FAFAD2" +colournames["lightgray"] = "#D3D3D3" +colournames["lightgreen"] = "#90EE90" +colournames["lightgrey"] = "#D3D3D3" +colournames["lightpink"] = "#FFB6C1" +colournames["lightsalmon"] = "#FFA07A" +colournames["lightseagreen"] = "#20B2AA" +colournames["lightskyblue"] = "#87CEFA" +colournames["lightslategray"] = "#778899" +colournames["lightslategrey"] = "#778899" +colournames["lightsteelblue"] = "#B0C4DE" +colournames["lightyellow"] = "#FFFFE0" +colournames["lime"] = "#00FF00" +colournames["limegreen"] = "#32CD32" +colournames["linen"] = "#FAF0E6" +colournames["magenta"] = "#FF00FF" +colournames["maroon"] = "#800000" +colournames["mediumaquamarine"] = "#66CDAA" +colournames["mediumblue"] = "#0000CD" +colournames["mediumorchid"] = "#BA55D3" +colournames["mediumpurple"] = "#9370DB" +colournames["mediumseagreen"] = "#3CB371" +colournames["mediumslateblue"] = "#7B68EE" +colournames["mediumspringgreen"] = "#00FA9A" +colournames["mediumturquoise"] = "#48D1CC" +colournames["mediumvioletred"] = "#C71585" +colournames["midnightblue"] = "#191970" +colournames["mintcream"] = "#F5FFFA" +colournames["mistyrose"] = "#FFE4E1" +colournames["moccasin"] = "#FFE4B5" +colournames["navajowhite"] = "#FFDEAD" +colournames["navy"] = "#000080" +colournames["oldlace"] = "#FDF5E6" +colournames["olive"] = "#808000" +colournames["olivedrab"] = "#6B8E23" +colournames["orange"] = "#FFA500" +colournames["orangered"] = "#FF4500" +colournames["orchid"] = "#DA70D6" +colournames["palegoldenrod"] = "#EEE8AA" +colournames["palegreen"] = "#98FB98" +colournames["paleturquoise"] = "#AFEEEE" +colournames["palevioletred"] = "#DB7093" +colournames["papayawhip"] = "#FFEFD5" +colournames["peachpuff"] = "#FFDAB9" +colournames["peru"] = "#CD853F" +colournames["pink"] = "#FFC0CB" +colournames["plum"] = "#DDA0DD" +colournames["powderblue"] = "#B0E0E6" +colournames["purple"] = "#800080" +colournames["rebeccapurple"] = "#663399" +colournames["red"] = "#FF0000" +colournames["rosybrown"] = "#BC8F8F" +colournames["royalblue"] = "#4169E1" +colournames["saddlebrown"] = "#8B4513" +colournames["salmon"] = "#FA8072" +colournames["sandybrown"] = "#F4A460" +colournames["seagreen"] = "#2E8B57" +colournames["seashell"] = "#FFF5EE" +colournames["sienna"] = "#A0522D" +colournames["silver"] = "#C0C0C0" +colournames["skyblue"] = "#87CEEB" +colournames["slateblue"] = "#6A5ACD" +colournames["slategray"] = "#708090" +colournames["slategrey"] = "#708090" +colournames["snow"] = "#FFFAFA" +colournames["springgreen"] = "#00FF7F" +colournames["steelblue"] = "#4682B4" +colournames["tan"] = "#D2B48C" +colournames["teal"] = "#008080" +colournames["thistle"] = "#D8BFD8" +colournames["tomato"] = "#FF6347" +colournames["turquoise"] = "#40E0D0" +colournames["violet"] = "#EE82EE" +colournames["wheat"] = "#F5DEB3" +colournames["white"] = "#FFFFFF" +colournames["whitesmoke"] = "#F5F5F5" +colournames["yellow"] = "#FFFF00" +colournames["yellowgreen"] = "#9ACD32" + + +function colourname2hex(colname) + if not colname then return "" end + if colname == "" then return "" end + if colname:sub(1,1) == "#" then + if #colname == 7 then + -- let's guess it's a hexcode as colour + return colname + end + end + if colournames[colname] then + return colournames[colname] + end + -- be safe and return nothing + return "" +end + + -dofile(modpath .. "/colournames.lua") local register_on_message = core.register_on_sending_chat_message if core.register_on_sending_chat_messages then |