Last active
June 20, 2019 10:40
-
-
Save vincevargadev/ce120397bc2f58f51337f6dc295972d1 to your computer and use it in GitHub Desktop.
Color palette for mcg.mbitson.com: Dart code Flutter MaterialColor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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