Skip to content

Colors in nested tables not drawn correctly #15

Description

@noorez

inner_table = Texttable()
inner_table.add_row([get_color_string(bcolors.GREEN, "Name"), "Noorez"])
inner_table.draw()
'+------+--------+\n| \x1b[92mName\x1b[0m | Noorez |\n+------+--------+'

the color maker is only on name

inner_table2 = Texttable()
inner_table2.add_row([get_color_string(bcolors.RED, "Name"), "Kassam"])
inner_table2.draw()
'+------+--------+\n| \x1b[91mName\x1b[0m | Kassam |\n+------+--------+'

as above the color marker is only on name

full_table.add_row([inner_table.draw()])
full_table.add_row([inner_table2.draw()])
full_table.draw()
'+-------------------+\n| \x1b[92m+------+--------+\x1b[0m |\n| \x1b[92m| Name | Noorez |\x1b[0m |\n| \x1b[92m+------+--------+\x1b[0m |\n+-------------------+\n| \x1b[91m+------+--------+\x1b[0m |\n| \x1b[91m| Name | Kassam |\x1b[0m |\n| \x1b[91m+------+--------+\x1b[0m |\n+-------------------+'

notice how now the color marker is on the entire cell? This causes the entire inner table to be colored when it should have only been the string "Name"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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