Skip to content

Instantly share code, notes, and snippets.

@glebtv
Created November 8, 2013 06:10
Show Gist options
  • Save glebtv/7366904 to your computer and use it in GitHub Desktop.
Save glebtv/7366904 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
Dir.chdir(ARGV[0])
cmd = "ack --css '#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})\\b' #{ARGV[0]}"
$stderr.puts cmd
resp = `#{cmd}`
resp.gsub! /#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/, '<span style="background-color: #\1\2;">#\1\2</span>'
puts '<html><pre>' + resp + '</pre></html>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment