change color of field / tag when selected

51 views
Skip to first unread message

unread,
Jun 23, 2021, 11:39:19 AM6/23/21
to TiddlyWiki

Hello,

is it possible to change the color of "published" and "tags" when selecting an entry in the search list:
(for "title" it is working fine...)
search.png

my Code:

<li class="tc-menu-list-item">
<$link to={{!!title}} tooltip="Titel: {{!!title}}">
<$view field="caption"><$view field="title"/></$view>
<small> --- </small>
<small style="color:rgba(144, 238, 144, 0.8)"><$view field="published" /></small>
<small> aus Gruppe: </small>
<small style="color:rgba(255, 201, 102, 0.8)"><$view field="tags"/></small>
</$link>
</li>

Thanks for feedback
Stefan

Soren Bjornstad

unread,
Jun 23, 2021, 12:29:59 PM6/23/21
to TiddlyWiki
If you switch to using a CSS class rather than the inline style to handle your coloring, you can use an a:hover selector to apply different styling when the cursor is over the link, like this:

<li class="tc-menu-list-item">
<$link to={{!!title}} tooltip="Titel: {{!!title}}">
<$view field="caption"><$view field="title"/></$view>
<small> --- </small>
<small class="myclass"><$view field="modified" /></small>
<small> aus Gruppe: </small>
<small class="myclass"><$view field="tags"/></small>
</$link>
</li>

<style>
.myclass {
  color: rgba(255, 201, 102, 0.8)
}
a:hover .myclass {
  color: red;
}
</style>

You can also use .myclass:hover as the selector instead of a:hover.myclass, but then you have to hover directly over the text for the color to change, rather than anywhere on the link.

I am not sure if this would work with a drop-down and keyboard selection.

Soren Bjornstad

unread,
Jun 23, 2021, 12:33:55 PM6/23/21
to TiddlyWiki
Note: On line 5, I switched the field from published to modified so I could test on TiddlyWiki.com and forgot to change it back. You probably want it to be published.

unread,
Jun 23, 2021, 12:46:20 PM6/23/21
to TiddlyWiki
Thanks a lot Soren - that's what I want.

I recognized line 5...

Perfect!
Reply all
Reply to author
Forward
0 new messages