So you just want the title block of the table to change color? The cells
have their own background attribute, called bgcolor.
So just rearrange the Template tiddler to have this text:
\define mytable(colorclass)
<table class="persontable ">
<tr><td colspan=2 bgcolor=$colorclass$> @@display:block;width:23em;color:
lightgrey; <<currentTiddler>> @@ </td></tr>
<tr><td> ''Value 1'' </td><td>@@display:block;width:15em;{{!!value1}}@@</td
></tr>
<tr><td>@@display:block;width:6.5em;''Value 2''@@
</td><td>@@display:block;width:15em;stuff@@
</td></tr>
<tr><td>@@display:block;width:6.5em;''Value 3''@@
</td><td>@@display:block;width:15em;@@
</td></tr>
</table>
\end
<$macrocall $name="mytable" colorclass={{!!tablecolor}}/>
Note that all I did was remove $colorclass$ from the table tag and add
bgcolor=$colorclass$ to the first <td> tag.
Hopefully we're getting close!
-- Mark
On Friday, October 12, 2018 at 9:01:00 PM UTC-7, Rafael Aprato wrote:
>
> So...I have good news, and I have bad news :/
>
> The good news is that it works! I can now select the color I want by
> writing in it the field. Don't even need to call the template inside the
> tiddler!
>
> The bad news is that what it does is color the letters of all the text
> inside the table...
>
> I should have started by posting what I'm aiming for. This is what I
> manually built, and want as an end result (don't mind the text, it's from
> Wikipedia):
>
> [image: Sem TÃtulo.png]
>
>
> So, what I want is just to have that grey in that one cell to be easily
> changeable, since it will save me from having dozens of templates (one
> color for each family).
>
> With your second files, I tried different solutions to solve this:
>
> - First I changed the "color" to "background-color". However, it colored
> the entire table, including the padding;
>
> - Then I tried ending the class inside the table somehow, so that only the
> title had the background. This didn't work, as it breaks the code;
>
> - Then, tried creating two tables: one for the title, another for the rest
> of the table (both class="persontable"). Had to insert "<div style =
> "clear:both;"></div>" between the two to make them appear on top of
> eachother, but it retains a space between the two. Managed to remove it
> with margins, but a small border between the two still remains. I'll
> probably be able to remove it, but it's not worth it if I don't solve the
> final issues:
>
> - The fact that the background color includes the padding, and the fact
> that it's not centered or bold. Managed to make it centered by substituting
> the <<>> with {{!tabletitle}} and adding "text-align:center;", but neither
> '' '' nor <b></b> work for bold as they did before. As for padding,
> changing it in "MyStyles" only makes the cell larger...it's still
> completely colored, instead of having the bit of color-less padding like in
> my example.
>
> At this point, I'm considering just creating one template for each color,
> it seems easier.
>
> What do you think? Is there an easy solution, or should I give up?
>
>
> Rafael
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/edf09c1b-4d9d-4a30-8826-4e954acf3bd3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.