Skip to content

Instantly share code, notes, and snippets.

@JeffJacobson
Last active November 9, 2022 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffJacobson/cb140baf71fea8297781dc86908214ad to your computer and use it in GitHub Desktop.
Save JeffJacobson/cb140baf71fea8297781dc86908214ad to your computer and use it in GitHub Desktop.
Commodore 64 color palette JSON and script that generated it
{
"Black": "#000000",
"White": "#FFFFFF",
"Red": "#880000",
"Cyan": "#AAFFEE",
"Violet / purple": "#CC44CC",
"Green": "#00CC55",
"Blue": "#0000AA",
"Yellow": "#EEEE77",
"Orange": "#DD8855",
"Brown": "#664400",
"Light red": "#FF7777",
"Dark grey / grey 1": "#333333",
"Grey 2": "#777777",
"Light green": "#AAFF66",
"Light blue": "#0088FF",
"Light grey / grey 3": "#BBBBBB"
}
// Ran this script on https://c64online.com/commodore-64-color-codes/ on 2022-11-09 to generate JSON file.
((table) => {
const firstCells = table.querySelectorAll("tr:not(:first-child) > td:first-child");
const rows = [...firstCells].map(c => c.parentElement.querySelectorAll("td:nth-child(2),td:last-child")).map(kv => [kv[0].textContent, kv[1].textContent]);
const output = {};
for (const [key, value] of rows) {
output[key] = value;
}
const colors = new Map([...rows]);
console.log(output)
console.log(JSON.stringify(output, undefined, 2))
})(document.body.querySelector("figure.wp-block-table:nth-child(12) > table:nth-child(1)"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment