TW5: table heading in-line background color

228 views
Skip to first unread message

Dave

unread,
May 21, 2017, 10:38:49 PM5/21/17
to TiddlyWiki
How would you change the background color of a table cell?

E.g. right now this
| !Lumbar Kemp's (right)  |

has a light grey background color.  I'd like to change it to a slightly darker shade for some cells, but not all (basically I'm wanting to do that with all test names which are "right" sided)

I was thinking there is probably something like the old @@highlight@@ syntax (I did try that and it didn't do anything, but even if it did, I'd still like to set the color specifically)


then I though of doing a tiddler tagged with $:/tags/Stylesheet :

rcol {
           background
-color:#FF8C19;
       
}



but I can't remember how to use that inline.  I tried this:


| !{rcol{{Lumbar Kemp's (right)}}}  

|


but that didn't work, nor did using just 2 brackets instead of 3.  Also the "!" isn't interfering because it doesn't work without that

I know I'm close, but can't seem to find the right way to do it.  If I do find it before someone answers I'll post it here.


Thanks,
Dave

Ton Gerner

unread,
May 22, 2017, 3:58:08 AM5/22/17
to TiddlyWiki
Hi Dave,

Dave Gifford's TW5mall doesn't exist anymore (quite a lot of table customizations), but have a look at http://tobibeer.github.io/tb5/#%24%3A%2Fstyles%2Ftablecell

Cheers,

Ton




Dave

unread,
May 31, 2017, 11:03:19 AM5/31/17
to TiddlyWiki
Thank you, I'll take a look :)

Dave

unread,
May 31, 2017, 11:53:32 AM5/31/17
to TiddlyWiki
okay, from that link I tried this:

.pink{
background
-color:#fef;
}


in a tiddler tagged 

$:/tags/Stylesheet




but I can't figure out how to make it work in practice

I've tried this:  {{pink{hello there}}} and this @@.pink hello there@@ and neither works


If I do this:
<style>
.pink{background-color:pink;}
</style>



that works inline (with the "@@"), but its kind of clunky and I'd like to do it using the stylesheet.

What am I missing?

Ton Gerner

unread,
May 31, 2017, 12:25:35 PM5/31/17
to TiddlyWiki
Hi Dave,

If you create a stylesheet containing:


.hcell{
/* compensating the cell padding */
margin
:-1px -7px; padding:1px 7px;
background
-color: #fef; }

you can use:
|!x|!y|!<div class="hcell">pink</div>|
|a|b|c|

You can then create a macro (Tiddler tagged with $:/tags/Macro) containing:
\define t(class, text)
<div class="$class$">$text$</div>
\end

and use it as:

|!x|!y|!<<t hcell pink>>|
|a|b|c|

Cheers,

Ton

Dave

unread,
May 31, 2017, 12:30:50 PM5/31/17
to TiddlyWiki

Thank you Ton, I'll give that a try.

(I wonder if I was thinking of TWClassic...)

I also noticed part of my mistake (worked with the @@ method) was not saving and reloading - D'Oh!  :)
Reply all
Reply to author
Forward
Message has been deleted
0 new messages