Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. /* Paste this code snippet into the console to convert to Dart code */
  2.  
  3. // Based on this, I could also submit a pull request one day...
  4.  
  5. const name = 'span.name.color-text';
  6. const hex = 'span.palette-color-hex.color-text';
  7. const paletteEntry = '.palette-color';
  8.  
  9. const mapContent = Array.from(document.querySelectorAll(paletteEntry))
  10. .slice(0, 10)
  11. .map(e => ({
  12. name: e.querySelector(name).innerText,
  13. hex: e.querySelector(hex).innerText
  14. }))
  15. .map(c => ` ${c.name}: Color(0xFF${c.hex.replace('#', '')}),`)
  16. .join('\n');
  17.  
  18. console.log(`<int, Color>{\n${mapContent}\n};`);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement