Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long header should apply colbgcolor to same width as header #9

Closed
erhhung opened this issue Jul 28, 2023 · 1 comment
Closed

Long header should apply colbgcolor to same width as header #9

erhhung opened this issue Jul 28, 2023 · 1 comment

Comments

@erhhung
Copy link

erhhung commented Jul 28, 2023

This issue is related to, and may be irrelevant once resolved by #8 (headbgcolor and colbgcolor should not be affected by colsep).

The natural column width is determined by the widest column value, whether that's the header or one of the rows. That same column width should be applied to both headbgcolor and colbgcolor, but it is currently not being applied to colbgcolor.

In the example below, the "Date" header is padded—as expected—by the longer "2023-07-28" values, but the wider "Column 2" header is not reflected in the padding of shorter version numbers like "1.0.0". The same is true with column 1 row values.

image

from ansitable import ANSITable, Column # ansitable 0.9.7

table = ANSITable(
  Column("Column 1", headalign="<", headcolor="white", headstyle="bold", headbgcolor="blue",
                      colalign="<",  colcolor="white",  colstyle="bold",  colbgcolor="blue"),
  Column("Column 2", headalign="^", headcolor="white", headstyle="bold", headbgcolor="blue",
                      colalign="<",  colcolor="light_magenta",            colbgcolor="blue"),
  Column("Date",     headalign="^", headcolor="white", headstyle="bold", headbgcolor="blue",
                      colalign="^",  colcolor="chartreuse_3b"),
  border="thick", bordercolor="cornflower_blue", colsep=4,
)
table.row("hello-world", "1.0.0", "2023-07-28")
table.row("foo-bar",     "0.1.0", "2023-07-28")
table.print()
@petercorke
Copy link
Owner

I'm looking at this as part of general maintenance caused by changes to the colored package. What behavior do you want to see? Should the colsep space have bgcolor? Should only the unpadded text have bgcolor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants