How do I theme tags and tag values?

First, How do I make a TaskPaper stylesheet!

Once you have a custom theme here are some example rules for styling tags:

  1. Change default tag color:

     run[tag] {
       color: green;
     }
    
  2. Change default color of only the tag name or tag value part of a tag:

     run[tagname] {
       color: blue;
     }
    
     run[tagvalue] {
       color: red;
     }
    
  3. Change color of specific tag. In this case the @priority tag is colored red:

     run[tag="data-priority"] {
       color: red;
     }
    
  4. Change color of specific tag and tag value combination. In this case @priority(2) is colored orange.

     item[data-priority="2"] {
       > run[tag="data-priority"] {
         color: orange;
       }
     }
2 Likes

Is it possible to target tags with relative values? Like <=[d] today?

Sorry no, but I agree it would be a good feature.

Given the task:

- Task @repeat(7) @due(2021-01-29)

Is it possible to style the due date (tag value) exclusively?

This styles the tag values of both @due and @repeat:

item[data-due] {
	> run[tagvalue] {
		color: red;
	}
}

I think this is what you want:

run[tag="data-due"] {
  color: red;
}
1 Like

Thank you, and sorry if I’m missing something—but doesn’t this style the whole tag (@due(2021-01-30) rather than only 2021-01-30? I’d like to style just the date, for better legibility.

The snippet I posted above does the trick, but also styles the values of the task’s other tags.

Ah… I missread, maybe this then:

run[tag="data-due"][tagvalue] {
  color: red;
}
3 Likes

Thank you; that’s it!