how to change background color in a table

0 votes
asked Jan 27, 2016 by mirecg (160 points)
I found that I can easyly create tables using title block (which is by the way little bit strange for me).
But don't know how to change the background color for the certain row, or how to turn odd/even coloring.
 
title
Example of simple table
|= |= table |= header |
| a | table | row |
| b | table | row |
end title
 

1 Answer

0 votes
answered Jan 27, 2016 by plantuml (132,110 points)

You cannot with current release.

However, we like the idea, so with last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

You can now have:

@startuml
title
|= |= table |= header |
| a | table | row |
|<#FF8080> red |<#80FF80> green |<#8080FF> blue |
<#yellow>| b | table | row |
endtitle

start
@enduml

Is this what you are looking for ?

commented Jan 28, 2016 by mirecg (160 points)
Great!
It even works when I place the color in front of a row, which sets background color for the whole row.

Would you mind to allow named colors and to support odd-even rows coloring automatically?
commented Jan 29, 2016 by plantuml (132,110 points)
Named colors is possible and working in the beta (see example with <#yellow> )

For odd-even rows colorings, the most difficult is to find a nice syntax.
Any suggestions ?
We could allow something like <odd:#yellow><even:#blue> in the table header ?
commented Jan 29, 2016 by mirecg (160 points)
Oh, I did not notice the named color in the example, sorry :-)

The syntax for odd/even rows that you have proposed looks simple and quite well. Go for that. Thank you!

I must ask one thing. Why this must be placed in title - endtitle block?
commented Feb 7 by anonymous
It's great, but shouldn't it be documented, for example in creole ?
commented Feb 10 by plantuml (132,110 points)
Sure, we've just updated the page http://plantuml.com/creole
The documentation is not always up to date, so do not hesitate to ping us again when you will find other missing point.

Thanks again!
...