User:An Orbit/Loona member box code: Difference between revisions
Jump to navigation
Jump to search
(heck) |
(No difference)
|
Revision as of 14:46, 6 June 2023
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 border = changeLuminance(data.color,6.5,"set","hex"); var data = loona[i]; 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)