Tables

Stone-color holds functions for creating tables on the terminal. These functions return a string which is the table that you can print out, example of use:

from stone_color import tables

header = ["Name", "Age"]
data = [
    ["Josh", "20"],
    ["Marco", "40"],
    ["Steven", "50"],
]

out = tables.ascii_table(header, data)
print(out)

Options

Each table function has these Options:

  • lspaces, type: int :: It is the margin from the left side of the terminal
  • start_end, type: str, default: "" :: It is what will be printed at the beginning and end of the table creation. It can be a \n to make it prettier output

Table styles

ascii_table
  Name      Surname
  ------    -------
  Marco     Togni  
  John      Gates  
  Marcus    Fresco
unicode_light_table
┌──────────────────┐
│ Name   │ Surname │
├──────────────────┤
│ Marco  │ Togni   │
│ John   │ Gates   │
│ Marcus │ Fresco  │
└──────────────────┘
unicode_heavy_table
╔══════════════════╗
║ Name   ║ Surname ║
╠══════════════════╣
║ Marco  ║ Togni   ║
║ John   ║ Gates   ║
║ Marcus ║ Fresco  ║
╚══════════════════╝