Sparky is similar to other spark-line based implementations but differs from them in that it slightly conforms towards (better) coding-standards used within the AsciiParadise project.

Certain ASCII sparks can be created on the commandline, but due to the UTF-8 nature of these sparks, one can in theory use any other code - including the dancing Unicode Snowman, for instance.

Unicode is not really covered by ASCII per se, but the reason why this was integrated into this project here is because it fulfills another goal of the project - to have animated characters on the commandline. You should see it like that, even though the name is “ascii_paradise”.

After installation, the commandline executable called sparky can be run.

A list of numbers should be given to it:

sparky 0 2 5 10 25 50 100 251

Data can also be passed into sparky:

echo 11 55 192 44 15 6 0 11 33 | sparky

If you wish to use sparky in ruby, you can use an API such as:

AsciiParadise.sparky([0, 35, 78, 92, 24, 162])

You can also sparky to colourize stuff. The bioroebe project makes use of this to denote the length of exons and introns in a gene.

More examples:

require 'ascii_paradise'

start =  5
end   = 13

list = [start, array]

puts “Issues: ”+Sparkr.sparkline(list)

But now you want to format the sparky line so that the open issues are red and the closed ones are green (to quickly see how you are doing).

Adding Term::ANSIColor to the foray:

require 'ascii_paradise'
require 'term/ansicolor'

class String
  include Term::ANSIColor
end

start =  5
end   = 13

list = [open_issue_count, closed_issue_count]
sparkline = AsciiParadise.sparky(list) { |tick, count, index|
  if index == 0
    tick.color(:red)
  else
    tick.color(:green)
  end
}
puts "Issues: " + sparkline