Custom styles by field value (is it possible?)

53 views
Skip to first unread message

Hubert

unread,
Sep 13, 2018, 3:51:18 AM9/13/18
to TiddlyWiki
Hello,

TW makes it possible to apply custom CSS styles to tiddlers based on their tags, as explained in the documentation.

In a similar fashion, would it be possible to have custom styles applied based on a pre-defined field value or is this functionality limited to tags at present?

Thank you in advance for your tips and insights :)

Best regards,
Hubert
Message has been deleted

Riz

unread,
Sep 13, 2018, 4:54:01 AM9/13/18
to TiddlyWiki
Any string mentioned in the field "class" is can be used as a css class in stylesheets. Is that what you are looking for?

Hubert

unread,
Sep 13, 2018, 4:58:45 AM9/13/18
to TiddlyWiki
I'm specifically trying to find a solution whereby I could manipulate the tiddler frame CSS element (tc-tiddler-frame) for a specific tiddler only, i.e. without affecting all the other tidders en masse.

The problem is that the CSS element called tc-tiddler-frame has to be defined in a different tiddler tagged $:/tags/Stylesheet to have any effect. However, it will then affect all tiddlers.

I've come accross Custom styles by data-tags as one solution that defined the set of tiddlers to manipulate but if a solution exists to modify an individual tiddler in this way that would solve it.

I'd rather not use tags for this; I'm relying more on fields and use tags sparingly.

My knowledge of CSS is limited, so I'd be grateful for any suggestions.

Thank you!

PMario

unread,
Sep 13, 2018, 5:17:29 AM9/13/18
to TiddlyWiki

Hubert

unread,
Sep 13, 2018, 5:26:07 AM9/13/18
to TiddlyWiki
Thank you! This is what I need, exactly.

TonyM

unread,
Sep 13, 2018, 7:41:59 AM9/13/18
to TiddlyWiki
Hubert

Just to let you I am using the class field set when I create tiddlers from templates, but change the class if needed. It works well.

I am also using the data classes to change the background of the tiddler title bar with status and the boarder when archived. There is very little we cant do. I only wish all the built in css names were better documented.

Regards
Tony

Hubert

unread,
Sep 13, 2018, 7:56:51 AM9/13/18
to TiddlyWiki
Tony,

Thanks for that, a great idea. I'm too creating most of my tiddlers using buttons with fields/tags set automatically in the process. Being able to dynamically manipulate CSS classes in this way as you say is one of the many things that make TW so great and flexible.

I've recently come across Jeremy's Github entry that included some CSS classes used in TW but did not take note of it and I'm unable to find it now. The TW documentation is a great starting point but it's certainly lacking.

Again, thanks to this great community for help!
Reply all
Reply to author
Forward
0 new messages