rainbox-0.26.0.0: Two-dimensional box pretty printing, with colors

Safe HaskellNone
LanguageHaskell2010

Rainbox.BicolorTable

Description

Functions and types to build BicolorTables. Everything you should typically need is exported from Rainbox.

Synopsis

Documentation

type BicolorTableCellLine = Seq Chunk Source #

A single line within a cell in a BicolorTable. For each Chunk, leave the back as the default if you want the Chunk background to match _bctEvenBackground or _bctOddBackground. If you specify a background color for any Chunk, it will for that Chunk override the table's background color.

type BicolorTableCell = Seq BicolorTableCellLine Source #

The set of all lines within a cell in a BicolorTable.

type BicolorTableRow = Seq BicolorTableCell Source #

The set of all columns in a single row. If any single row is narrower than the widest row in the table, it will be padded with empty cells so that it is the same width as the widest row in the table.

data BicolorTable Source #

Description for a table with rows of alternating background colors. For instance, if designed for a terminal with a white background, the row backgrounds might alternate between white and light grey. The different backgrounds help with readability.

For the Chunk that are in the table, simply leave the back color blank if you wish to use the row's background color. Upon rendering, bicolorTable will render the Chunk with a background color that matches that of the row. If you specify a background color for a Chunk, it will override the background color for the row.

Note that a row may contain more than one line of text.

Unlike tables built with tableByRows or tableByColumns, all tables built with bicolorTable will have separator colums between each column.

Constructors

BicolorTable 

Fields

Instances
Show BicolorTable Source # 
Instance details

Defined in Rainbox.BicolorTable

hPutBicolorTable :: Handle -> BicolorTable -> IO () Source #

Creates a bi-color table and renders it to the given Handle using bicolorTable and hPutBox.

putBicolorTable :: BicolorTable -> IO () Source #

Creates a bi-color table and renders it to standard output using hPutBicolorTable.

convertChunkForRendering Source #

Arguments

:: Radiant

Background for this row

-> Chunk 
-> Chunk 

Convert a Chunk for rendering by substituting the table's row background for the chunk's row background if applicable.

bicolorToPlainCell Source #

Arguments

:: Radiant

Appropriate background color

-> Alignment Vertical

Column alignment

-> BicolorTableCell 
-> Cell 

Convert a BicolorTable cell to a plain Cell. Does all necessary Chunk conversions.

bicolorToPlainRow Source #

Arguments

:: Radiant

Background color for even rows

-> Radiant

Background color for odd rows

-> Int

Width of spacer cells

-> Int

Number for this row

-> Seq (Alignment Vertical)

Column alignments

-> BicolorTableRow 
-> Seq Cell 

Convert a BicolorTable row to a plain Row. Does all necessary Chunk conversions. Includes spacer cells.

bicolorToPlainTable :: BicolorTable -> Seq (Seq Cell) Source #

Converts a BicolorTable table to a plain table with Cell. Does all necessary Chunk conversions, and includes spacer cells.

padBicolorTable :: BicolorTable -> BicolorTable Source #

Pads out _bctAlignments so that it is as long as the longest row in the table, and pads out each row in _bctRows so that it is as long as the longest row in the table.