pytablewriter-altrow-theme

A pytablewriter plugin to provide a theme that colored rows alternatively.


Keywords
pytablewriter, plugin, theme, pytablewriter-plugin
License
MIT
Install
pip install pytablewriter-altrow-theme==0.2.0

Documentation

Summary

PyPI package version Supported Python versions Supported Python implementations CI status of Linux/macOS/Windows Test coverage: coveralls

pytablewriter-altrow-theme is a pytablewriter plugin to provide a theme that colored rows alternatively.

Installation

pip install pytablewriter-altrow-theme

Usage

Sample Code:
import pytablewriter as ptw

writer = ptw.TableWriterFactory.create_from_format_name(
    "markdown",
    headers=["INT", "STR"],
    value_matrix=[
        [1, "hoge"],
        [2, "foo"],
        [3, "bar"],
    ],
    margin=1,
    theme="altrow",
)
writer.write_table()
Output:
https://github.com/thombashi/pytablewriter-altrow-theme/blob/master/ss/ptw-altrow-theme_example_default.png

You can change the color of the theme by using the color parameter:

Sample Code:
import pytablewriter as ptw

writer = ptw.TableWriterFactory.create_from_format_name(
    "markdown",
    headers=["INT", "STR"],
    value_matrix=[
        [1, "hoge"],
        [2, "foo"],
        [3, "bar"],
    ],
    margin=1,
)

writer.set_theme("altrow", color="yellow")

writer.write_table()
Output:
https://github.com/thombashi/pytablewriter-altrow-theme/blob/master/ss/ptw-altrow-theme_example_yellow.png

Other Examples

Dependencies