Draw.io – How to Change Table Background Color in Draw.io

draw.io

How do I change the background color of one cell or one row of a table?

I can only seem to change the background color of the entire table in draw.io yet shapes exist that have some of he other cells colored differently?

I'm just trying to get a shape with a table that has a heading with a different background color so if there's any other way to do this that would be helpful as well.

Best Answer

It's a pain. If you double-click the table to enter 'edit mode', you view the HTML for the table, by clicking the HTML button in the top toolbar. enter image description here (This is only visible when editing an entity.) The table styles are done inline. And the HTML is unformatted so it all just shows up on one line.

For example, if you use the 'green' table in the 'Misc' panel, you can search for:

<tr style="background-color: #eaf2d3 ; border: 1px solid #98bf21">

and change the color to what ever you want. But this only changes that specific row.

If your using Draw.io online, you can at least take advantage of the browser's native search in page function ('CMD+F' or 'CTL+F') to find and replace the color string.

I havn't figured out to search with the desktop/chromeapp version.

Edit: After playing around a bit, I found it was much easier to build your own table just using a group of rectangles.

After arranging the rectangles with correct height and width, group them. 'Arrange -> Group' or 'CTL+G'. The group allows the table to be moved around as one object, instead of individual entities.

You can then select Rows or Columns just by dragging a selection rectangle. You can tab through all the fields, and just start typing.

It's much easier than trying to use the pre-built examples.

enter image description here