Hi Joe
We can use wikitext primitives within stylesheets to make conditional rules.
Tiny bit of background about stylesheets: TiddlyWiki in the browser renders all tiddlers tagged $:/tags/Stylesheet into a <style> element. Tiddlers of content type text/css will be processed as raw CSS, but tiddlers with the content type text/vnd.tiddlywiki (the default) are processed by first wikifying them, and then extracting the plain text portion. (So, for example, if a text/vnd.tiddlywiki stylesheet were to contain the text "<p>23</p>", the plain text content would be the string “23”).
There’s a danger of inadvertent wikification of stylesheet text, and so we usually use a /rules pragma to restrict the wikitext rules that will be observed within the stylesheet to just transclusion and macro invocations:
\rules only filteredtranscludeinline transcludeinline macrocallinline macrocallblock
Putting the pieces together, here’s a stylesheet that sets the page background colour to red whenever the sidebar is hidden: