diff --git a/src/art/vector/Set_Colour_Outfit.tw b/src/art/vector/Set_Colour_Outfit.tw
index a58c9d3dcceadef849c97b021964a850480fafb3..83c2590bf88c42d37ac14d74efc549f4fc32a55c 100644
--- a/src/art/vector/Set_Colour_Outfit.tw
+++ b/src/art/vector/Set_Colour_Outfit.tw
@@ -4,39 +4,6 @@
 /* BEWARE: _outfitBaseColour is read by Wardrobe Use */
 /* BEWARE: _glassesColour is read by Wardrobe Use */
 
-<<unset _outfitBaseColour>>
-
-<<if _artSlave.fuckdoll != 0 || _artSlave.clothes == "restrictive latex" ||  _artSlave.clothes == "a latex catsuit" ||  _artSlave.clothes == "a cybersuit">>
-  <<set _outfitBaseColour = "#515351" >> /* standard "black rubber" latex colour */
-  <<if def _artSlave.clothingBaseColor>>
-    <<set _outfitBaseColour = _artSlave.clothingBaseColor >> /* latex colour selected by user */
-    /* TODO: rewrite all textual descriptions not to explicitly mention the latex being of black colour. */
-	<</if>>
-<</if>>
-<<if _artSlave.fuckdoll != 0 || _artSlave.clothes == "a comfortable bodysuit">>
-  <<set _outfitBaseColour = "#464646" >> /* bodysuit */
-  <<if def _artSlave.clothingBaseColor>>
-    <<set _outfitBaseColour = _artSlave.clothingBaseColor >> /* bodysuit colour selected by user */
-	<</if>>
-<</if>>
-
-/* head addons */
-<<switch _artSlave.eyewear>>
-  <<case "corrective glasses" "glasses" "blurring glasses">>
-    <<set _glassesColour = "#010101">>
-  <<default>>
-    /* use colour for "glasses" by default */
-    <<set _glassesColour = "#010101">>
-<</switch>>
-
-<<switch _artSlave.collar>>
-  <<case "porcelain mask">>
-    <<set _glassesColour = "#FFFFFF">>
-  <<default>>
-    /* use colour for "mask" by default */
-    <<set _glassesColour = "#010101">>
-<</switch>>
-
-<<if def _artSlave.glassesColor>>
-  <<set _glassesColour = _artSlave.glassesColor>> /* glasses colour selected by user */
-<</if>>
\ No newline at end of file
+<<set _s = Art_Vector_Set_Colour_Outfit(_artSlave) >>
+<<set _outfitBaseColour = _s.outfitBaseColour>>
+<<set _glassesColour = _s.glassesColor>>
diff --git a/src/art/vector/Set_Colour_Outfit_JS.tw b/src/art/vector/Set_Colour_Outfit_JS.tw
new file mode 100644
index 0000000000000000000000000000000000000000..02d864d598e457cc7430fdcefb9d3a31c41f2235
--- /dev/null
+++ b/src/art/vector/Set_Colour_Outfit_JS.tw
@@ -0,0 +1,51 @@
+:: Art_Vector_Set_Colour_Outfit_JS [script]
+
+window.Art_Vector_Set_Colour_Outfit = function(artSlave) {
+
+var s = {
+  outfitBaseColour : undefined,
+  glassesColour : undefined
+  }
+
+if (artSlave.fuckdoll != 0 || artSlave.clothes == "restrictive latex" ||  artSlave.clothes == "a latex catsuit" ||  artSlave.clothes == "a cybersuit") {
+  s.outfitBaseColour = "#515351" ; /* standard "black rubber" latex colour */
+  if (artSlave.clothingBaseColor) {
+    s.outfitBaseColour = artSlave.clothingBaseColor ; /* latex colour selected by user */
+    /* TODO: rewrite all textual descriptions not to explicitly mention the latex being of black colour. */
+  }
+}
+
+if (artSlave.fuckdoll != 0 || artSlave.clothes == "a comfortable bodysuit") {
+  s.outfitBaseColour = "#464646" ; /* bodysuit */
+  if (artSlave.clothingBaseColor) {
+    s.outfitBaseColour = artSlave.clothingBaseColor ; /* bodysuit colour selected by user */
+  }
+}
+
+/* head addons */
+switch (artSlave.eyewear) {
+  case "corrective glasses":
+  case "glasses": 
+  case "blurring glasses":
+    s.glassesColour = "#010101";
+    break;
+  default:
+    /* use colour for "glasses" by default */
+    s.glassesColour = "#010101";
+}
+
+switch (artSlave.collar) {
+  case "porcelain mask":
+    s.glassesColour = "#FFFFFF";
+    break;
+  default:
+    /* use colour for "mask" by default */
+    s.glassesColour = "#010101";
+}
+
+if (artSlave.glassesColor) {
+  s.glassesColour = artSlave.glassesColor; /* glasses colour selected by user */
+}
+
+return s;
+}