diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 5a1d49d0338caa89b72635d3512614144348327e..4c0baa5bc496757b03f2c41727da4f73092825fe 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -2482,6 +2482,12 @@ This is basically a reference to a C++ `ServerActiveObject`
 * `set_eye_offset({x=0,y=0,z=0},{x=0,y=0,z=0})`: defines offset value for camera per player
     * in first person view
     * in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)
+* `get_nametag_color()`
+    * returns the color of the nametag as table
+    * { a = 0...255, r = 0...255, g = 0...255, b = 0...255 }
+* `set_nametag_color(color)`
+    * sets the color of the nametag
+    * `color`: { a = 0...255, r = 0...255, g = 0...255, b = 0...255 }
 
 ### `InvRef`
 An `InvRef` is a reference to an inventory.
diff --git a/src/content_cao.cpp b/src/content_cao.cpp
index a8b107b49692630eec80667ea04ae4b457f1fe83..5bf4d8e9ccd3e905beb7b4a1d4d8218d749e0732 100644
--- a/src/content_cao.cpp
+++ b/src/content_cao.cpp
@@ -552,6 +552,7 @@ GenericCAO::GenericCAO(IGameDef *gamedef, ClientEnvironment *env):
 		m_animated_meshnode(NULL),
 		m_wield_meshnode(NULL),
 		m_spritenode(NULL),
+		m_nametag_color(video::SColor(255, 255, 255, 255)),
 		m_textnode(NULL),
 		m_position(v3f(0,10*BS,0)),
 		m_velocity(v3f(0,0,0)),
@@ -962,7 +963,7 @@ void GenericCAO::addToScene(scene::ISceneManager *smgr, ITextureSource *tsrc,
 		gui::IGUIEnvironment* gui = irr->getGUIEnvironment();
 		std::wstring wname = narrow_to_wide(m_name);
 		m_textnode = smgr->addTextSceneNode(gui->getSkin()->getFont(),
-				wname.c_str(), video::SColor(255,255,255,255), node);
+				wname.c_str(), m_nametag_color, node);
 		m_textnode->grab();
 		m_textnode->setPosition(v3f(0, BS*1.1, 0));
 	}
@@ -1714,6 +1715,11 @@ void GenericCAO::processMessage(const std::string &data)
 			int rating = readS16(is);
 			m_armor_groups[name] = rating;
 		}
+	} else if (cmd == GENERIC_CMD_SET_NAMETAG_COLOR) {
+		m_nametag_color = readARGB8(is);
+		if (m_textnode != NULL) {
+			m_textnode->setTextColor(m_nametag_color);
+		}
 	}
 }
 	
diff --git a/src/content_cao.h b/src/content_cao.h
index 31ccd04d43f564bede9e29f3b31ea7c738847b9c..36245bd3b0cfa74e2bed8aea9fac1a610889c171 100644
--- a/src/content_cao.h
+++ b/src/content_cao.h
@@ -71,6 +71,7 @@ class GenericCAO : public ClientActiveObject
 	scene::IAnimatedMeshSceneNode *m_animated_meshnode;
 	WieldMeshSceneNode *m_wield_meshnode;
 	scene::IBillboardSceneNode *m_spritenode;
+	video::SColor m_nametag_color;
 	scene::ITextSceneNode* m_textnode;
 	v3f m_position;
 	v3f m_velocity;
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 51f074f7cf08f906920fdcd91ea76857f8b0ea17..0aae7bbc25af8e1446e13ec56048d31cea8e2981 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -715,6 +715,8 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
 	m_bone_position_sent(false),
 	m_attachment_parent_id(0),
 	m_attachment_sent(false),
+	m_nametag_color(video::SColor(255, 255, 255, 255)),
+	m_nametag_sent(false),
 	// public
 	m_physics_override_speed(1),
 	m_physics_override_jump(1),
@@ -801,7 +803,7 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version)
 		writeF1000(os, m_player->getYaw());
 		writeS16(os, getHP());
 
-		writeU8(os, 5 + m_bone_position.size()); // number of messages stuffed in here
+		writeU8(os, 6 + m_bone_position.size()); // number of messages stuffed in here
 		os<<serializeLongString(getPropertyPacket()); // message 1
 		os<<serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2
 		os<<serializeLongString(gob_cmd_update_animation(m_animation_range, m_animation_speed, m_animation_blend)); // 3
@@ -812,6 +814,7 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version)
 		os<<serializeLongString(gob_cmd_update_physics_override(m_physics_override_speed,
 				m_physics_override_jump, m_physics_override_gravity, m_physics_override_sneak,
 				m_physics_override_sneak_glitch)); // 5
+		os << serializeLongString(gob_cmd_set_nametag_color(m_nametag_color)); // 6
 	}
 	else
 	{
@@ -965,6 +968,14 @@ void PlayerSAO::step(float dtime, bool send_recommended)
 		ActiveObjectMessage aom(getId(), true, str);
 		m_messages_out.push(aom);
 	}
+
+	if (m_nametag_sent == false) {
+		m_nametag_sent = true;
+		std::string str = gob_cmd_set_nametag_color(m_nametag_color);
+		// create message and add to list
+		ActiveObjectMessage aom(getId(), true, str);
+		m_messages_out.push(aom);
+	}
 }
 
 void PlayerSAO::setBasePosition(const v3f &position)
@@ -1144,6 +1155,17 @@ void PlayerSAO::notifyObjectPropertiesModified()
 	m_properties_sent = false;
 }
 
+void PlayerSAO::setNametagColor(video::SColor color)
+{
+	m_nametag_color = color;
+	m_nametag_sent = false;
+}
+
+video::SColor PlayerSAO::getNametagColor()
+{
+	return m_nametag_color;
+}
+
 Inventory* PlayerSAO::getInventory()
 {
 	return m_inventory;
diff --git a/src/content_sao.h b/src/content_sao.h
index cc372ff5572a67b910f583a286248a41e5696d3a..4a8c70e16b9061da26cf922a097ff8b9178d219b 100644
--- a/src/content_sao.h
+++ b/src/content_sao.h
@@ -197,6 +197,8 @@ class PlayerSAO : public ServerActiveObject
 	void setAttachment(int parent_id, std::string bone, v3f position, v3f rotation);
 	ObjectProperties* accessObjectProperties();
 	void notifyObjectPropertiesModified();
+	void setNametagColor(video::SColor color);
+	video::SColor getNametagColor();
 
 	/*
 		Inventory interface
@@ -313,6 +315,9 @@ class PlayerSAO : public ServerActiveObject
 	v3f m_attachment_rotation;
 	bool m_attachment_sent;
 
+	video::SColor m_nametag_color;
+	bool m_nametag_sent;
+
 public:
 	float m_physics_override_speed;
 	float m_physics_override_jump;
diff --git a/src/genericobject.cpp b/src/genericobject.cpp
index 9a1b9d8d0dc657b109220b3d2a2d5877cce5277d..1f4f59e92b4ad17b1843752fef03c9a80223c362 100644
--- a/src/genericobject.cpp
+++ b/src/genericobject.cpp
@@ -170,3 +170,12 @@ std::string gob_cmd_update_attachment(int parent_id, std::string bone, v3f posit
 	return os.str();
 }
 
+std::string gob_cmd_set_nametag_color(video::SColor color)
+{
+	std::ostringstream os(std::ios::binary);
+	// command
+	writeU8(os, GENERIC_CMD_SET_NAMETAG_COLOR);
+	// parameters
+	writeARGB8(os, color);
+	return os.str();
+}
diff --git a/src/genericobject.h b/src/genericobject.h
index 29e5e29cb67481fc30846d6649bda20581eeb83d..854950d27e5dd534050c6cf9a3b41b5fff24f6d7 100644
--- a/src/genericobject.h
+++ b/src/genericobject.h
@@ -34,6 +34,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #define GENERIC_CMD_SET_BONE_POSITION 7
 #define GENERIC_CMD_SET_ATTACHMENT 8
 #define GENERIC_CMD_SET_PHYSICS_OVERRIDE 9
+#define GENERIC_CMD_SET_NAMETAG_COLOR 10
 
 #include "object_properties.h"
 std::string gob_cmd_set_properties(const ObjectProperties &prop);
@@ -72,5 +73,7 @@ std::string gob_cmd_update_bone_position(std::string bone, v3f position, v3f rot
 
 std::string gob_cmd_update_attachment(int parent_id, std::string bone, v3f position, v3f rotation);
 
+std::string gob_cmd_set_nametag_color(video::SColor color);
+
 #endif
 
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index d913019b1811cc2f4aaebb0f945c02766cc5d1ab..c639a48343dc5b0b03ec05b16a661a0e8c4e368f 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1274,6 +1274,48 @@ int ObjectRef::l_override_day_night_ratio(lua_State *L)
 	return 1;
 }
 
+// set_nametag_color(self, color)
+int ObjectRef::l_set_nametag_color(lua_State *L)
+{
+	NO_MAP_LOCK_REQUIRED;
+	ObjectRef *ref = checkobject(L, 1);
+	PlayerSAO *playersao = getplayersao(ref);
+	if (playersao == NULL)
+		return 0;
+
+	video::SColor color(255,255,255,255);
+	if (!lua_isnil(L, 2))
+		color = readARGB8(L, 2);
+	playersao->setNametagColor(color);
+
+	lua_pushboolean(L, true);
+	return 1;
+}
+
+// get_nametag_color(self)
+int ObjectRef::l_get_nametag_color(lua_State *L)
+{
+	NO_MAP_LOCK_REQUIRED;
+	ObjectRef *ref = checkobject(L, 1);
+	PlayerSAO *playersao = getplayersao(ref);
+	if (playersao == NULL)
+		return 0;
+
+	video::SColor color = playersao->getNametagColor();
+
+	lua_newtable(L);
+	lua_pushnumber(L, color.getAlpha());
+	lua_setfield(L, -2, "a");
+	lua_pushnumber(L, color.getRed());
+	lua_setfield(L, -2, "r");
+	lua_pushnumber(L, color.getGreen());
+	lua_setfield(L, -2, "g");
+	lua_pushnumber(L, color.getBlue());
+	lua_setfield(L, -2, "b");
+
+	return 1;
+}
+
 ObjectRef::ObjectRef(ServerActiveObject *object):
 	m_object(object)
 {
@@ -1396,5 +1438,7 @@ const luaL_reg ObjectRef::methods[] = {
 	luamethod(ObjectRef, override_day_night_ratio),
 	luamethod(ObjectRef, set_local_animation),
 	luamethod(ObjectRef, set_eye_offset),
+	luamethod(ObjectRef, set_nametag_color),
+	luamethod(ObjectRef, get_nametag_color),
 	{0,0}
 };
diff --git a/src/script/lua_api/l_object.h b/src/script/lua_api/l_object.h
index daf91ce56c02621ae6d57bcf097a2b1a9c456649..1f2931f2984bef63d088f34ccd45ef8432876c6d 100644
--- a/src/script/lua_api/l_object.h
+++ b/src/script/lua_api/l_object.h
@@ -240,6 +240,12 @@ class ObjectRef : public ModApiBase {
 	// set_eye_offset(self, v3f first pv, v3f third pv)
 	static int l_set_eye_offset(lua_State *L);
 
+	// set_nametag_color(self, color)
+	static int l_set_nametag_color(lua_State *L);
+
+	// get_nametag_color(self)
+	static int l_get_nametag_color(lua_State *L);
+
 public:
 	ObjectRef(ServerActiveObject *object);