Last active
June 12, 2021 15:23
-
-
Save jomifepe/2380e7203ca218b9f88c531a028247e2 to your computer and use it in GitHub Desktop.
Simple script to get all HTML colors from w3schools as a TypeScript union (https://www.w3schools.com/colors/colors_names.asp)
This file contains hidden or 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 it on the console, while in: https://www.w3schools.com/colors/colors_names.asp | |
const colors = [...document.querySelectorAll('.colornamespan')].map((el) => el.textContent.toLowerCase()) | |
const union = [...colors].reduce((acc, name) => `${acc}| '${name}'\n`, ''); | |
console.log(union); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment