This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

How to create a custom tiddler colour rule

6th December 2021 at 4:51pm

Here we show how to add a rule to the Tiddler Colour Cascade that causes tiddlers with the tag to be given a bright blue colour and tiddlers with the tag to be given a dark purple colour.

Tip
How to create a custom tiddler icon rule describes how the same tiddlers have been given a custom icon

First, we add a new step to the tiddler colour cascade. The new filter step is:

[tag[TableOfContents]then[#1e90ff]]
[tag[Working with TiddlyWiki]then[darkorchid]]

It can be read as:

If the tiddler has the tag "TableOfContents" then return the colour #1e90ff
Else if the tiddler has the tag "Working with TiddlyWiki" then return the colour darkorchid

The tiddler colour cascade is defined by the tag , so we need to create a configuration tiddler with that tag.

We also need to make sure that it is inserted at the correct point in the cascade:

  • The new rule must be after the "colour-field" rule to ensure that tiddlers with an explicit color field will respect the value of that field
  • The new rule must be before the "default" icon otherwise it will never be seen if the default colour is specified

The control panel "Cascades" tab shows that this can be achieved by inserting the new step immediately before the default step using the list-before field.

The full list of fields in the configuration tiddler is:

$:/_tw5.com/CustomTiddlerColourCascadeDemo

created20211206114433294
list-before$:/config/TiddlerColourFilters/default
modified20211206114433294
tags$:/tags/TiddlerColourFilter
text[tag[TableOfContents]then[#1e90ff]] [tag[Working with TiddlyWiki]then[darkorchid]]
typetext/vnd.tiddlywiki