Made all invalid palette colors appear under "Other" color

This commit is contained in:
SwingTheVine 2025-08-20 00:19:11 -04:00
parent ed15a15577
commit 5707943734
6 changed files with 30 additions and 21 deletions

File diff suppressed because one or more lines are too long

View file

@ -49,7 +49,7 @@
<a href="https://discord.gg/tpeBPy46hf" target="_blank" rel="noopener noreferrer"><img alt="Contact Me" src="https://img.shields.io/badge/Contact_Me-gray?style=flat&logo=Discord&logoColor=white&logoSize=auto&labelColor=cornflowerblue"></a>
<a href="https://bluemarble.camilledaguin.fr/" target="_blank" rel="noopener noreferrer"><img alt="Blue Marble Website" src="https://img.shields.io/badge/Blue_Marble_Website-Camille_Daguin-blue?style=flat&logo=globe&logoColor=white"></a>
<a href="" target="_blank" rel="noopener noreferrer"><img alt="WakaTime" src="https://img.shields.io/badge/Coding_Time-111hrs_12mins-blue?style=flat&logo=wakatime&logoColor=black&logoSize=auto&labelColor=white"></a>
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Patches" src="https://img.shields.io/badge/Total_Patches-508-black?style=flat"></a>
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Patches" src="https://img.shields.io/badge/Total_Patches-509-black?style=flat"></a>
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Lines of Code" src="https://tokei.rs/b1/github/SwingTheVine/Wplace-BlueMarble?category=code"></a>
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Total Comments" src="https://tokei.rs/b1/github/SwingTheVine/Wplace-BlueMarble?category=comments"></a>
<a href="" target="_blank" rel="noopener noreferrer"><img alt="Compression" src="https://img.shields.io/badge/Compression-69.52%25-blue"></a>

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "wplace-bluemarble",
"version": "0.84.13",
"version": "0.84.14",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wplace-bluemarble",
"version": "0.84.13",
"version": "0.84.14",
"devDependencies": {
"esbuild": "^0.25.0",
"jsdoc": "^4.0.4",

View file

@ -1,6 +1,6 @@
{
"name": "wplace-bluemarble",
"version": "0.84.13",
"version": "0.84.14",
"type": "module",
"homepage": "https://bluemarble.camilledaguin.fr/",
"repository": {

View file

@ -1,7 +1,7 @@
// ==UserScript==
// @name Blue Marble
// @namespace https://github.com/SwingTheVine/
// @version 0.84.13
// @version 0.84.14
// @description A userscript to automate and/or enhance the user experience on Wplace.live. Make sure to comply with the site's Terms of Service, and rules! This script is not affiliated with Wplace.live in any way, use at your own risk. This script is not affiliated with TamperMonkey. The author of this userscript is not responsible for any damages, issues, loss of data, or punishment that may occur as a result of using this script. This script is provided "as is" under the MPL-2.0 license. The "Blue Marble" icon is licensed under CC0 1.0 Universal (CC0 1.0) Public Domain Dedication. The image is owned by NASA.
// @author SwingTheVine
// @license MPL-2.0

View file

@ -652,31 +652,40 @@ function buildOverlayMain() {
.sort((a,b) => b[1].count - a[1].count); // sort by frequency desc
for (const [rgb, meta] of entries) {
const [r,g,b] = rgb.split(',').map(Number);
const row = document.createElement('div');
let row = document.createElement('div');
row.style.display = 'flex';
row.style.alignItems = 'center';
row.style.gap = '8px';
row.style.margin = '4px 0';
const swatch = document.createElement('div');
let swatch = document.createElement('div');
swatch.style.width = '14px';
swatch.style.height = '14px';
swatch.style.border = '1px solid rgba(255,255,255,0.5)';
swatch.style.background = `rgb(${r},${g},${b})`;
const label = document.createElement('span');
let label = document.createElement('span');
label.style.fontSize = '12px';
let labelText = `${meta.count.toLocaleString()}`;
try {
const tMeta = templateManager.templatesArray?.[0]?.rgbToMeta?.get(rgb);
if (tMeta && typeof tMeta.id === 'number') {
const displayName = tMeta?.name || `rgb(${r},${g},${b})`;
const starLeft = tMeta.premium ? '★ ' : '';
labelText = `#${tMeta.id} ${starLeft}${displayName}${labelText}`;
}
} catch (_) {}
// Special handling for "other" and "transparent"
if (rgb === 'other') {
swatch.style.background = '#888'; // Neutral color for "Other"
labelText = `Other • ${labelText}`;
} else if (rgb === '#deface') {
swatch.style.background = '#deface';
labelText = `Transparent • ${labelText}`;
} else {
const [r, g, b] = rgb.split(',').map(Number);
swatch.style.background = `rgb(${r},${g},${b})`;
try {
const tMeta = templateManager.templatesArray?.[0]?.rgbToMeta?.get(rgb);
if (tMeta && typeof tMeta.id === 'number') {
const displayName = tMeta?.name || `rgb(${r},${g},${b})`;
const starLeft = tMeta.premium ? '★ ' : '';
labelText = `#${tMeta.id} ${starLeft}${displayName}${labelText}`;
}
} catch (ignored) {}
}
label.textContent = labelText;
const toggle = document.createElement('input');