[tw5] Programmatic Tag Colors/Icons/Fields

Hello all,

I’ve been reading Grok Tiddlywiki to help organize my own personal wiki. I’m starting to reach the point where I need to organize my tags better.

I understand that the Tag Manager exists for this purpose, but I was hoping for something that allows me to sort tags into groups by colors, and icons programmatically.

For instance, I have tags specifically for technical links, like “math”, “compilers”, “comp_arch”, that would all be perfect for a color and icon I use purely for “technical” tags, with a tiddler that shows me what colors map to which group. However, if I decide I don’t like this color/icon, I want to be able to change a single tiddler, and all tags in the same group get the new color/icon. Is there a way to accomplish this with transclusion?

On a related note: is there a way in general to transclude from a tiddler such that the target tiddler inherits the fields of the source tiddler?


To personalize your organization of tags, it sounds like you to to tweak the $:/core/macros/tag tiddler .

For each tag, you’ll need to create a tiddler, in which you can specify fields of information for each tag. Fields that your custom $:/core/macros/tag tiddler can use for anything you could think of.

Although I have not customized that $:/core/macros/tag tiddler, I have played a little bit with setting up colors on some of my tags in one of my TiddlyWikis. Check this link for very simple color customization: TiddlyWiki Programming Fundamentals —

Say you have “Tag A”, and it is itself tagged (or has a field) indicating “Tag A” is of the category “Group 1”, your modified $:/core/macros/tag might do something of the lines of checking what category a tag is, and decide that the tag should have a category and icon that are found in fields of the tiddler called “Group1”.

Something like that.

1 Like

Sorry no, that’s not possible. …

As a workaround, if you create a new tiddler you can use the “Clone” button in the “More” section of the tiddler toolbar. … or …

You can use the “New here” button, which will pre populate the tag of the new tiddler with the name of the “old” tiddler, where you used the button.


Arg, I pointed you to the wrong shadow tiddler. I should have suggested that you look at $:/core/ui/TagTemplate.

Apologies !

Please find attached a file for you to download, drag into TiddlyWiki.com, and study.

This is my way of setting up inheritance.

I have “Some Tiddler” tagged with “Tag Category 1”.

I have the “Tag Category 1” tiddler (i.e. the tiddler that matches the tag) in which I’ve specified a “color” field and selected a color that will show for that tag.

I have “Some Other Tiddler” tagged with “Test Tag 1”.

And I have the “Test Tag 1” tiddler (i.e. the tiddler that matches the tag) in which I’ve specified a “Tag_Category” field, and set the value of that field to “Tag Category 1”.

The intent is this: when a tag’s matching tiddler has a “Tag_Category” specified, I want that tiddler to inherit (well, use) the color specified in the tiddler specified in Tag_Category. If the tag’s matching tiddler does not have a “Tag_Category” field, then I want that tiddler to have the color specified in the color field. If it has no color field, then it will have the default color for tags.

The magic happens in the edit I’ve made to the $:/core/ui/TagTemplate.

Look for: colour={{{ [get[Tag_Category]get[color]] [get[color]] +[first[]] }}}

The original code was: colour={{!!color}}

Cheers, and Best wishes !

TagColorInheritance.json (1.56 KB)

You may find that colour={{{ [get[Tag_Category]get[color]] [get[color]] +[last[]] }}} makes more sense?

i.e. “if I have a color specified and a Tag_Category that specified a color, my color overrides the category color. Otherwise, I’ll use the category color.”

Something like that.