Last active
June 12, 2021 15:24
-
-
Save jomifepe/3dec3e199240e2e07c7310159f721996 to your computer and use it in GitHub Desktop.
Simple script to get all HTML colors from w3schools as a TypeScript enum (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 enumString = 'export enum HtmlColor {\n' + colors.map((color) => `\t${color} = '${color}'`).join(',\n') + ',\n}'; | |
console.log(enumString); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment