Skip to content

Instantly share code, notes, and snippets.

@vincevargadev
Last active June 20, 2019 10:40
Show Gist options
  • Save vincevargadev/ce120397bc2f58f51337f6dc295972d1 to your computer and use it in GitHub Desktop.
Save vincevargadev/ce120397bc2f58f51337f6dc295972d1 to your computer and use it in GitHub Desktop.
Color palette for mcg.mbitson.com: Dart code Flutter MaterialColor
/* Paste this code snippet into the console to convert to Dart code */
// Based on this, I could also submit a pull request one day...
const name = 'span.name.color-text';
const hex = 'span.palette-color-hex.color-text';
const paletteEntry = '.palette-color';
const mapContent = Array.from(document.querySelectorAll(paletteEntry))
.slice(0, 10)
.map(e => ({
name: e.querySelector(name).innerText,
hex: e.querySelector(hex).innerText
}))
.map(c => ` ${c.name}: Color(0xFF${c.hex.replace('#', '')}),`)
.join('\n');
console.log(`<int, Color>{\n${mapContent}\n};`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment