The following script searches STDIN for 3 or 6 symbol hex values and prints a html structure that represents those values as colors on page.
To view example output hit "read more".
#!/usr/bin/perl -w use Set::Scalar; $uniqueColors = Set::Scalar->new; while( defined( $_ = <STDIN> ) ){ while ( $_ =~/(#[a-fA-F0-9]{1,6})/g ){ $uniqueColors->insert( $1 ) } } print <<HEADER; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>Found HEX colors</TITLE> </HEAD> <BODY> HEADER while ( defined( my $color = $uniqueColors->each ) ){ print "<p style=\"background: " . $color . "\">" . $color . "</p>\n" } print "</BODY> </HTML>"Used this one to parse color-theme-tangotango.el emacs color theme file.
To view example output hit "read more".