Skip to content

Instantly share code, notes, and snippets.

@volo1st
Created October 19, 2016 07:34
Show Gist options
  • Save volo1st/e867dc4e6e3081cbb0cc876308a889ec to your computer and use it in GitHub Desktop.
Save volo1st/e867dc4e6e3081cbb0cc876308a889ec to your computer and use it in GitHub Desktop.
Find out how many colours are being used in your project
echo 'Uniq hex colors:'
egrep -oIR '#([a-f]|[A-F]|[0-9]){3}(([a-f]|[A-F]|[0-9]){3})?\b' . | cut -d':' -f2 | tr "[A-Z]" "[a-z]" | sort -u
echo 'Uniq rgba colors:'
egrep -oIR "rgba\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*((0.[1-9])|[01])\\s*\\)" . | cut -d':' -f2 | tr "[A-Z]" "[a-z]" | sort -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment