tabled icon indicating copy to clipboard operation
tabled copied to clipboard

Add `Theme` support

Open zhiburt opened this issue 2 years ago • 1 comments

The idea to have a text and border style which might be called Theme.

So it could look something like this.

image Seen https://github.com/jedib0t/go-pretty/blob/main/table/images/table-StyleColoredBright.png

The implementation would require some color library which would require adding a new feature flag.

I'd like to note that the look like this is must be working already, but it must be set by the user by manual changes in cell content and cell borders.

zhiburt avatar May 10 '22 07:05 zhiburt

The theme could be responsible for a layout of a table, e.g #130 .

The implementation I have in mind is to have a ThemeBuilder which would be responsible for the layout and for text formatting.

Though now it gets interesting because we have IndexBuilder whose build method returns Table so ThemeBuilder and IndexBuilder won't able to be called at the same time.

Also a note that we have a default style Style::default. If ThemeBuilder is used it must be responsible for the style.

If it will be merged some-when we probably need to put some important message to Format type that it should be used with caution.

Of we would better have a ThemeBuilder and LayoutBuilder?

zhiburt avatar May 15 '22 12:05 zhiburt

We could create colorization as a different structure.

table.with(Colorization::new(color1, color2).pattern(ColorizationPattern::Chess))
enum ColorizationPattern {
  Columns,
  Rows,
  Chess,
}

zhiburt avatar Oct 17 '22 14:10 zhiburt

Done by Colorization. Though the idea of themes still valid; there's more things we could do with this for example as Layout.

zhiburt avatar Jun 28 '23 13:06 zhiburt