Skip to content

Instantly share code, notes, and snippets.

@golgote
Created November 8, 2011 11:40
Show Gist options
  • Save golgote/1347562 to your computer and use it in GitHub Desktop.
Save golgote/1347562 to your computer and use it in GitHub Desktop.
Use palette.pl in TextMate to output colors used in a CSS file
#!/usr/bin/env ruby
# Palette is a Perl tool that creates a color swatch from a CSS file
# http://code.google.com/p/css-palette/source/browse/trunk/src/palette.pl
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/executor"
require ENV["TM_SUPPORT_PATH"] + "/lib/tm/save_current_document"
palette = ENV["TM_BUNDLE_SUPPORT"] + "/palette.pl"
TextMate.save_current_document
TextMate::Executor.make_project_master_current_document
TextMate::HTMLOutput.show(:window_title => "Palette", :page_title => "Palette", :sub_title => "#{ENV["TM_FILEPATH"]}") do |io|
io << TextMate::Process.run(palette, "--src=#{ENV["TM_FILEPATH"]}")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment