djm / table_rex

An Elixir app which generates text-based tables for display

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coloring just an specific row

kimjoaoun opened this issue · comments

Is there a way to select colors for just one line? For example, I have the table below and I'd want do change the color of the second row (the one with data types) to red. Is there a simple way to do so?

+--------------+-------------+--------------+-------------+-------------+
| sepal_length | sepal_width | petal_length | petal_width | species     |
+==============+=============+==============+=============+=============+
| <float>      | <float>     | <float>      | <float>     | <string>    |
| 5.1          | 3.5         | 1.4          | 0.2         | Iris-setosa |
| 4.9          | 3.0         | 1.4          | 0.2         | Iris-setosa |
| 4.7          | 3.2         | 1.3          | 0.2         | Iris-setosa |
| 4.6          | 3.1         | 1.5          | 0.2         | Iris-setosa |
| 5.0          | 3.6         | 1.4          | 0.2         | Iris-setosa |
+--------------+-------------+--------------+-------------+-------------+

Maybe in this case it is best to disable the header separator and print an empty line instead by using empty values?

+--------------+-------------+--------------+-------------+-------------+
| sepal_length | sepal_width | petal_length | petal_width | species     |
| <float>      | <float>     | <float>      | <float>     | <string>    |
|              |             |              |             |             |
| 5.1          | 3.5         | 1.4          | 0.2         | Iris-setosa |
| 4.9          | 3.0         | 1.4          | 0.2         | Iris-setosa |
| 4.7          | 3.2         | 1.3          | 0.2         | Iris-setosa |
| 4.6          | 3.1         | 1.5          | 0.2         | Iris-setosa |
| 5.0          | 3.6         | 1.4          | 0.2         | Iris-setosa |
+--------------+-------------+--------------+-------------+-------------+

WDYT?

That's possible! And it'll avoid the possible user mistake of thinking the <types> row is part of the dataset.