diff --git a/lib/uplot/command.rb b/lib/uplot/command.rb index 9924c60..c4df5d3 100644 --- a/lib/uplot/command.rb +++ b/lib/uplot/command.rb @@ -193,6 +193,11 @@ module Uplot params.xlim = get_lim(v) end + parsers[:colors] + .on('-n', '--names', TrueClass) do |v| + @color_names = v + end + # Preventing the generation of new sub-commands parsers.default = nil @@ -242,6 +247,12 @@ module Uplot def run parse_options + + if command == :colors + Plot.colors + exit + end + # Sometimes the input file does not end with a newline code. while input = Kernel.gets(nil) input.freeze diff --git a/lib/uplot/plot.rb b/lib/uplot/plot.rb index 2bab8f2..79ebed0 100644 --- a/lib/uplot/plot.rb +++ b/lib/uplot/plot.rb @@ -123,6 +123,18 @@ module Uplot UnicodePlot.boxplot(headers, series, **params.to_hc) end + def colors + UnicodePlot::StyledPrinter::TEXT_COLORS.each do |k,v| + print v + print k + print "\t" + print " ●" + print "\033[0m" + print "\t" + end + puts + end + def check_series_size(data, fmt) series = data.series if series.size == 1