unicode_plot.rb
unicode_plot.rb copied to clipboard
Ad-hoc changing the colours + document this in the README
What if all APIs, such as UnicodePlot.barplot(), also support an argument called colors?
For instance:
UnicodePlot.barplot(data: {'foo': 20, 'bar': 50}, colors: "steelblue").render
This would use steelblue rather than green (the default).
Right now this leads to an error:
.gem/gems/unicode_plot-0.0.5/lib/unicode_plot/plot.rb:10:in `initialize': unknown
keyword: :colors (ArgumentError)
We could also fine-tune this perhaps ... if colors: is too generic, we could say main_color: or foreground_color or color1: color2: and so on. Being able to pass it in directly via a Hash is the important part here. That way we can fine-tune the APIs here, to different use cases. Perhaps even to render them as HTML "strings" (e. g. via CSS actually; my idea here is to allow for this to be used in a web-page as-is, a "drop in" replacement).