Skip to content

Instantly share code, notes, and snippets.

@phroa
Created April 7, 2015 05:22
Show Gist options
  • Save phroa/8174f635f095e8c54d16 to your computer and use it in GitHub Desktop.
Save phroa/8174f635f095e8c54d16 to your computer and use it in GitHub Desktop.
takes mintty formatted colors on stdin and outputs a ton of mirc commands to set that as a colorscheme. works with generally black-on-white schemes
#!/usr/bin/env ruby
colorvalues = {
foregroundcolour: 0,
backgroundcolour: 1,
cursorcolour: -1,
black: -2,
boldblack: -3,
blue: 2,
green: 3,
boldred: 4,
red: 5,
magenta: 6,
yellow: 7,
boldyellow: 8,
boldgreen: 9,
cyan: 10,
boldcyan: 11,
boldblue: 12,
boldmagenta: 13,
white: 14,
boldwhite: 15
}
def symbolize input
input.gsub(/\s+/, '').downcase.to_sym
end
$stdin.each_line do |line|
next if line.empty? || line == "\n"
line_sym = symbolize line.split("=")[0]
puts "//color #{colorvalues[line_sym]} $rgb(#{line.split('=')[1].strip})" unless colorvalues[line_sym] < 0
end
puts '//color Background 1'
puts '//color ListBox 1'
puts '//color ListBox Text 0'
puts '//color TreeBar 1'
puts '//color TreeBar Text 0'
puts '//color Own text 0'
puts '//color Normal text 0'
puts '//color Gray text 0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment