View Source IO.ANSI.Table.Options (IO ANSI Table v1.0.34)

Documents the options and table styles used in the IO.ANSI.Table API.

Options

  • :align_specs - to align column elements (list of align specs where :left is the default align attribute). Defaults to [].

    align_specs: [
      center: "station_id", right: "pressure_mb", right: "pressure_in"
    ]
    align_specs: [left: "station_id", right: "wind_mph"]
    align_specs: ["station_id", right: "wind_mph"]
  • :async - whether to format the table asynchronously (boolean). Defaults to false.

  • :bell - whether to ring the bell (boolean). Defaults to false.

  • :count - number of maps/keywords/structs to format (integer). Defaults to 11.

    count: 11 # first 11 sorted `maps`
    count: -11 # last 11 sorted `maps`
  • :header_fixes - to alter the headers once changed to "title case" (map). Defaults to %{}.

    header_fixes: %{
      # "station_id" => "Station ID"
      ~r[ id$]i       => " ID",
      # "wind_mph" => "Wind MPH"
      ~r[ mph$]i      => " MPH",
      # "observation_time_rfc822" => "Observation Time RFC-822"
      ~r[ rfc(\d+)$]i => " RFC-\\1"
    }
    header_fixes: %{
      " A "   => " a ",
      " An "  => " an ",
      " And " => " and ",
      " At "  => " at ",
      " But " => " but ",
      " By "  => " by ",
      " For " => " for ",
      " Not " => " not ",
      " Of "  => " of ",
      " On "  => " on ",
      " Or "  => " or ",
      " So "  => " so ",
      " The " => " the ",
      " To "  => " to ",
      " Yet " => " yet "
    }
  • :margins - to position the table (keyword). Defaults to [top: 1, bottom: 1, left: 2]

    margins: [ # default margins
      top:    1, # line(s) before table (can be negative)
      bottom: 1, # line(s) after table
      left:   2  # column(s) left of table
    ]
    margins: [ # example of a side-by-side table
      top:    -11, # move cursor up 11 lines!!
      bottom:   1,
      left:    35, # move cursor forward 35 columns!!
    ]
  • :max_width - to cap column widths (non neg integer). Defaults to 99.

  • :sort_specs - to sort the maps/keywords/structs (list of sort specs where :asc is the default sort attribute). Defaults to [].

    sort_specs: ["station_id", "wind_mph"]
    sort_specs: ["station_id", desc: "wind_mph", desc: "temp_c"]
    sort_specs: [asc: "station_id", desc: "wind_mph"]
    sort_specs: ["dept", desc: {"hired", Date}]
    sort_specs: [{"hired", Date}, "job", {:desc, "dept"}]
    sort_specs: [{"hired", Date}, desc: "dept"]
  • :sort_symbols - to denote sort direction (keyword list of sort symbols). Defaults to [asc: "↑", desc: "↓", pos: :trailing].

    sort_symbols: [asc: "↑", desc: "↓", pos: :trailing] # default sort symbols
    sort_symbols: [asc: " ▲ ", desc: " ▼ ", pos: [:leading, :trailing]]
    sort_symbols: [asc: "⬆", desc: "⬇", pos: :leading]
  • :spec_name - to identify the table spec server (string). Defaults to the current application name expressed as a string.

  • :style - table style (atom). Defaults to :plain.

    style: :plain # default style
    style: :dark

Table styles

  • :bare - no colors
  • :barish - like bare but colored
  • :cyan - cyan background
  • :cyan_alt - cyan header, alternating row colors
  • :cyan_border - light cyan border
  • :cyan_mult - cyan header, 3 repeating row colors
  • :dark - dark colors
  • :dark_alt - dark colors, alternating row colors
  • :dark_mult - dark colors, 3 repeating row colors
  • :dashed - no colors
  • :dotted - slightly colored
  • :dotted_alt - slightly colored, alternating row colors
  • :dotted_mult - slightly colored, 3 repeating row colors
  • :game - game board
  • :green - green background
  • :green_alt - green header, alternating row colors
  • :green_border - light green border
  • :green_border_padded - light green border with extra padding
  • :green_border_unpadded - light green border without padding
  • :green_mult - green header, 3 repeating row colors
  • :green_padded - like green but with extra padding
  • :green_unpadded - like green but without padding
  • :light - light colors
  • :light_alt - light colors, alternating row colors
  • :light_mult - light colors, 3 repeating row colors
  • :medium - medium colors
  • :medium_alt - medium colors, alternating row colors
  • :medium_mult - medium colors, 3 repeating row colors
  • :mixed - fillers revealed
  • :plain - slightly colored
  • :pretty - multicolored
  • :pretty_alt - multicolored, alternating row colors
  • :pretty_mult - multicolored, 3 repeating row colors
  • :test - no colors
  • :yellow - light yellow background
  • :yellow_border - light yellow border