Last active
May 23, 2018 01:31
-
-
Save rxw1/b83a8d0c3d510ffa1ee342b5d5a8cb65 to your computer and use it in GitHub Desktop.
Get hex values and color names for Googles Material Design Color Palette
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
#!/usr/bin/env zsh | |
curl -s https://material.io/guidelines/style/color.html |\ | |
pup 'div.col-list section.module-module-module.col-3:nth-last-of-type(n+2) div span text{}' |\ | |
awk '/^[A-Z][a-z]+/{cat=$0} /^[A]{0,1}[0-9]{2,3}/{shade=$0} /^#[0-9A-F]{6}/ {printf("%4s, %-11s, %s\n",shade,cat,$0)}' |\ | |
cat -n |\ | |
sort -t, -k3 |\ | |
tac |\ | |
uniq -f1 |\ | |
sort -nk1 |\ | |
cut -f2- |\ | |
column -t -s, | |
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
#!/usr/bin/awk -f | |
/^[A-Z][a-z]+/ { | |
cat=$0 | |
} | |
/^[A]{0,1}[0-9]{2,3}/ { | |
shade=$0 | |
} | |
/^#[0-9A-F]{6}/ { | |
printf("%4s, %-11s, %s\n", shade, cat, $0) | |
} |
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
#!/bin/zsh | |
curl -s https://material.io/guidelines/style/color.html | pup 'div.col-list section.module-module-module.col-3:nth-last-of-type(n+2) div span text{}' |\ | |
./parse.awk | cat -n | sort -t, -nk2 | tac | uniq -f1 | sort -nk1 | cut -f2- | column -t -s, -R1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment