Skip to content

fgcolor and bgcolor does not seem to work #11

@bluecmd

Description

@bluecmd

Using the example from the README:

from ansitable import ANSITable, Column, Cell

table = ANSITable("col1", "column 2 has a big header", "column 3")
table.row("aaaaaaaaa", 2.2, 3)
table.row("bbbbbbbbbbbbb", Cell(-5.5, bgcolor="blue"), 6, bgcolor="yellow")
table.row("ccccccc", 8.8, 9)
table.print()

Results in the following using the current master of ansitable:

[fedora]$ python3 test.py
Traceback (most recent call last):
  File "/home/bluecmd/work/linkinsane/test.py", line 7, in <module>
    table.print()
  File "/home/bluecmd/work/linkinsane/ansitable/table.py", line 828, in print
    print(str(self), file=file)
          ^^^^^^^^^
  File "/home/bluecmd/work/linkinsane/ansitable/table.py", line 870, in __str__
    text += self._row(i)  # add a row
            ^^^^^^^^^^^^
  File "/home/bluecmd/work/linkinsane/ansitable/table.py", line 788, in _row
    text += c._formatcolumn(
            ^^^^^^^^^^^^^^^^
  File "/home/bluecmd/work/linkinsane/ansitable/table.py", line 266, in _formatcolumn
    text = self.table.BG(bgcolor) + text + self.table.BG(0)
           ^^^^^^^^^^^^^
AttributeError: 'ANSITable' object has no attribute 'BG'. Did you mean: '_BG'?

It is the same issue with using fgcolor, with the error being that no attribute named FG exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions