Colorize system tags

@twMat
It is the pulldown in each tiddler (done on https://tiddlywiki.com/)

Hello @Mohammad,

tag is colorized but not in the “tag”-pulldown of the tiddler… (tested on https://tiddlywiki.com/)

OK, right, it does not work there. The tagpills seen in view mode is this

where you can see how there exists a data-tag-title attribute which is what the proposed solution uses and which can sense if the tag itself is prefixed with $:/ but in edit mode the tags in the dropdown have another structure like so

where it is not possible to use the same method to identify that it is prefixed such.

So, I’m afraid I don’t have any better idea :frowning:

But I note that if tags are manually colored via the tag manager then they do properly show also in edit view and that dropdown. So there are ways to achieve it but probably at a deeper level than pure css.

Please do not try on your own wiki except you take a backup before clicking :wink:
This is a destructive test!

<$button actions="""
<$list filter="[is[system]] :filter[tagging[]]">
<$action-setfield color="#ff0000"/>
</$list>
"""> Just do it</$button>

If you want to inject your customization into core tiddler, then do as below

<$button actions="""
<$list filter="[all[tiddlers+shadows]is[system]] :filter[tagging[]]">
<$action-setfield color="#ff0000"/>
</$list>
"""> Just do it</$button>

1 Like

Yes, but @Alvaro explained the reason! See his post above!

Side note:

Testing on: TiddlyWiki — a non-linear personal web notebook

Before test, we have 9 overridden shadows

After test, we have 36 overridden shadows

This test did not destroy anything! But my own way is to keep shadow tiddlers specially the core tiddler intact (as much as I can)!

Thanks to all (@Alvaro, @twMat and @Mohammad) – input much appreciated!

This is a footnote to this thread which I found interesting!

We do have already the excellent inbuilt Tag Manager at: https://tiddlywiki.com/#%24%3A%2FTagManager that can set colours for non-system Tiddlers.

Can’t it just be liberated to be able to set colours for system Tiddlers too?

Just a comment
TT

1 Like

This will get you the red pills in the tag-picker menu, as long as the hr element is not removed.

Put this code in a tiddler tagged with $:/tags/Stylesheet

<style>
.tc-edit-tags .tc-block-dropdown-wrapper hr + a .tc-tag-label,
.tc-edit-tags .tc-block-dropdown-wrapper hr + a ~ a .tc-tag-label { background-color: red; color: white !important; }
</style>

redPills

2 Likes

Now it iza get cloze…

image

It would SO MUCH easier to do stuff like this if the system tag pills just had a system class applied to them… :thinking:

Thanks @Brian_Radspinner - that is what I want :slight_smile: :+1:

Try this:

Edit shadow $:/core/macros/tag. In the tag-pill-inner(...) macro definition, change:

class="tc-tag-label tc-btn-invisible"

to

class={{{ [[tc-tag-label tc-btn-invisible]] [<__tag__>prefix[$:/]then[tc-tag-system]] +[join[ ]] }}}

Edit shadow $:/core/ui/EditTemplate/tags. In the tag-body-inner(...) macro definition, change

<span style=<<tag-styles>> class="tc-tag-label tc-tag-list-item tc-small-gap-right">

to

<span style=<<tag-styles>> class={{{ [[tc-tag-label tc-tag-list-item tc-small-gap-right]] [{!!title}prefix[$:/]then[tc-tag-system]] +[join[ ]] }}}>

Edit shadow $:/core/ui/TagPickerTagTemplate and change:

<span class="tc-tag-label tc-btn-invisible" style=<<tag-pill-styles>>>

to

<span class={{{ [[tc-tag-label tc-btn-invisible]] [{!!title}prefix[$:/]then[tc-tag-system]] +[join[ ]] }}} style=<<tag-pill-styles>>>

Then, create a new tiddler (e.g. MySystemTagStyles), tagged with $:/tags/Stylesheet, containing:

.tc-tag-system { color:white !important; background-color:red !important; }

Notes:

  • The first three changes conditionally add the tc-tag-system class for tags that begin with $:/
    • $:/core/macros/tag defines the <<tag>> macro that is used to display tags in the tiddler ViewTemplate title area (and also anywhere in the tiddler body content).
    • $:/core/ui/EditTemplate/tags is used to display the tags in the tiddler EditTemplate controls.
    • $:/core/ui/TagPickerTagTemplate is used to display the tag buttons in the EditTemplate tag picker dropdown.
  • The stylesheet tiddler defines the desired foreground and background colors for elements with class tc-tag-system. Note that the !important is needed to override the colors set by the direct style=... attributes used in the various macros/templates that display tags. If you omit the !important (or delete the stylesheet), the tag colors will revert to the normal TWCore handling.

enjoy,
-e

4 Likes

Another approach to this whole thing is to build a list of all known system tags, colour them according to a set of different groups they belong to, then extract this color list into a data tiddler which can be installed with a button on any given wiki and color all the system tags but creating or editing them (Actually just set field will do).

As result you do not only get one color but sets of meaningful colours to groups system tiddlers further. Here is what my reference wiki shows for my system tags;

Thanks @EricShulman - you did it - it is perfect now! :+1:
I marked it as “Solution”.

Greetings
Stefan