2014-02-12 17:55:24 +00:00
|
|
|
namespace :asciinema do
|
|
|
|
desc 'Generate color palettes'
|
|
|
|
task :gen_color_palettes do
|
|
|
|
require 'yaml'
|
2012-03-15 08:53:26 +00:00
|
|
|
|
2014-02-12 17:55:24 +00:00
|
|
|
default = YAML.load_file('config/colors/default.yml')
|
|
|
|
rgb = YAML.load_file('config/colors/rgb.yml')
|
|
|
|
colors = default.merge(rgb)
|
2012-03-15 08:53:26 +00:00
|
|
|
|
2014-02-12 17:55:24 +00:00
|
|
|
out = ""
|
2012-03-15 08:53:26 +00:00
|
|
|
|
2014-02-12 17:55:24 +00:00
|
|
|
colors.each do |n, value|
|
|
|
|
out << ".fg#{n} { color: #{value} }\n"
|
|
|
|
out << ".bg#{n} { background-color: #{value} }\n"
|
|
|
|
end
|
2012-03-15 08:53:26 +00:00
|
|
|
|
2014-02-12 17:55:24 +00:00
|
|
|
File.open('app/assets/stylesheets/colors.css', 'w') { |f| f.write out }
|
2012-03-15 08:53:26 +00:00
|
|
|
|
2014-02-12 17:55:24 +00:00
|
|
|
File.open('app/assets/javascripts/player/colors.js', 'w') do |f|
|
|
|
|
f.write "Asciinema.colors = #{JSON.dump(colors)};"
|
|
|
|
end
|
2012-03-15 08:53:26 +00:00
|
|
|
end
|
|
|
|
end
|