User:An Orbit/Loona member box code
Jump to navigation
Jump to search
The following JS code uses functions from Sandboxels's code_library.js
mod. It can be used by running the code in a browser JavaScript console while in a Sandboxels tab that has the mod enabled and loaded.
loona = [ {name: "HeeJin", color: "#FF007F", emoji: "🐰"}, {name: "HyunJin", color: "#fffb00", emoji: "🐱"}, {name: "HaSeul", color: "#00cc00", emoji: "🕊"}, {name: "YeoJin", color: "#ff7f00", emoji: "🐸"}, {name: "ViVi", color: "#ffcfff", emoji: "🦌"}, {name: "Kim Lip", color: "#fc1e1e", emoji: "🦉"}, {name: "JinSoul", color: "#0f87ff", emoji: "🐯"}, //officially 🐟 {name: "Choerry", color: "#8f00bf", emoji: "🐿"}, //officially 🦇 {name: "Yves", color: "#7f005f", emoji: "🦢"}, {name: "Chuu", color: "#ffb980", emoji: "🐧"}, {name: "Go Won", color: "#97efaf", emoji: "🦋"}, {name: "Hyeju", color: "#afafaf", emoji: "🐺"} //Olivia Hye ]; function getY(color) { var color = convertHslObjects(normalizeColorToHslObject(color),"rgbjson"); return (0.2126 * color.r) + (0.7152 * color.g) + (0.0722 * color.b) }; var userboxesOut = ""; for(var i in loona) { var data = loona[i]; var border = changeLuminance(data.color,6.5,"set","hex"); var leftBack = changeLuminance(changeSaturation(data.color,0.99,"multiply","hsljson"),1.06,"multiply","hex"); var rightBack = data.color; var backgroundBrightness = getY(data.color); var textColorToUse = backgroundBrightness > 175 ? "black" : "white" var leftFront = textColorToUse; var rightFront = textColorToUse; var leftText = data.emoji + "️"; // U+FE0F emoji variation selector var rightText = `This user loves ${data.name}`; userboxesOut += `{{User:An Orbit/2 text userbox |border-color = ${border} |left-background-color = ${leftBack} |left-text-color = ${leftFront} |left-text = ${leftText} |right-background-color = ${rightBack} |right-text-color = ${rightFront} |right-text = ${rightText} }}` }; copy(userboxesOut)