Skip to content

Commit

Permalink
hopefully updated icons
Browse files Browse the repository at this point in the history
  • Loading branch information
nooodl committed Jul 29, 2011
1 parent 8632c10 commit c0ba0eb
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions icons.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'RMagick'
include Magick
$CGANAMES = %w(black blue green cyan red magenta brown lgray gray lblue lgreen lcyan lred lmagenta yellow white)

def cga(cname)
n = $CGANAMES.index cname
c = Array.new(3) {|i| n[2-i] * 0xAA + n[3] * 0x55}
c[1] = 0x55 if n == 6
return c
end

def write_icon(filename, color, symbol)
color = cga(color) if color.is_a? String
r, g, b = *color
fg = "rgb(#{r>>0},#{g>>0},#{b>>0})"
bg = "rgb(#{r>>4},#{g>>4},#{b>>4})"

img = Image.new(50, 50) {self.background_color = bg}
Draw.new.annotate(img, 0, 0, 0, 0, symbol) {
self.font_family = 'DejaVu Sans Mono'
self.fill = fg
self.pointsize = 40
self.gravity = CenterGravity
}
img.border(2, 2, fg).write("./icons/#{filename}.png")
end

write_icon *$_.split while DATA.gets

__END__
old-ascension lgray <
anti-stoner red x
escapologist brown (
Binary file added icons/anti-stoner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/escapologist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion icons/old-ascension.png

This file was deleted.

Binary file added icons/old-ascension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c0ba0eb

Please sign in to comment.