Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions and types to build BicolorTable
s. Everything you should
typically need is exported from Rainbox.
Synopsis
- type BicolorTableCellLine = Seq Chunk
- type BicolorTableCell = Seq BicolorTableCellLine
- type BicolorTableRow = Seq BicolorTableCell
- data BicolorTable = BicolorTable {}
- bctSpacerWidth :: Lens' BicolorTable Int
- bctRows :: Lens' BicolorTable (Seq BicolorTableRow)
- bctOddBackground :: Lens' BicolorTable Radiant
- bctEvenBackground :: Lens' BicolorTable Radiant
- bctAlignments :: Lens' BicolorTable (Seq (Alignment Vertical))
- bicolorTableToBox :: BicolorTable -> Box Vertical
- hPutBicolorTable :: Handle -> BicolorTable -> IO ()
- putBicolorTable :: BicolorTable -> IO ()
- convertChunkForRendering :: Radiant -> Chunk -> Chunk
- convertBicolorTableCellLineForRendering :: Radiant -> BicolorTableCellLine -> BicolorTableCellLine
- convertBicolorTableCellForRendering :: Radiant -> BicolorTableCell -> BicolorTableCell
- bicolorToPlainCell :: Radiant -> Alignment Vertical -> BicolorTableCell -> Cell
- bicolorToPlainRow :: Radiant -> Radiant -> Int -> Int -> Seq (Alignment Vertical) -> BicolorTableRow -> Seq Cell
- bicolorToPlainTable :: BicolorTable -> Seq (Seq Cell)
- padBicolorTable :: BicolorTable -> BicolorTable
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.
BicolorTable | |
|
Instances
Show BicolorTable Source # | |
Defined in Rainbox.BicolorTable showsPrec :: Int -> BicolorTable -> ShowS # show :: BicolorTable -> String # showList :: [BicolorTable] -> ShowS # |
bicolorTableToBox :: BicolorTable -> Box Vertical Source #
Transforms a BicolorTable
to a Box
.
hPutBicolorTable :: Handle -> BicolorTable -> IO () Source #
putBicolorTable :: BicolorTable -> IO () Source #
Creates a bi-color table and renders it to standard output
using hPutBicolorTable
.
convertChunkForRendering Source #
Convert a Chunk
for rendering by substituting the table's
row background for the chunk's row background if applicable.
convertBicolorTableCellLineForRendering :: Radiant -> BicolorTableCellLine -> BicolorTableCellLine Source #
Converts a BicolorTableCellLine
for rendering.
convertBicolorTableCellForRendering :: Radiant -> BicolorTableCell -> BicolorTableCell Source #
Converts a BicolorTableCell
for rendering.
:: Radiant | Appropriate background color |
-> Alignment Vertical | Column alignment |
-> BicolorTableCell | |
-> Cell |
Convert a BicolorTable cell to a plain Cell. Does all necessary Chunk conversions.
:: 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.