[TW5] Migrating a theme from a stylesheet to a system theme

179 views
Skip to first unread message

Hiru Yoru

unread,
Nov 19, 2016, 9:12:46 PM11/19/16
to TiddlyWiki
Hi,

I've created several fully-featured themes for TW5. I had to create these each in different copies of TW5, though, because I've installed them through the method mentioned on the main TW site, where you add $:/tags/Stylesheet as a tag to the tiddler containing the CSS definitions.

How can I migrate these themes to being accessible as choices in the configuration menu, like the vanilla theme?

(Note that these themes I've created don't completely rewrite the layout and do use vanilla as a base, so that would have to be taken into consideration.)

I did create palettes for these themes, but those are already accessible via the configuration menu.

Before I do this, I just wanted to make sure that what I'm doing would be correct. This is my thought for how this could be done:
  1. Clone the $:/themes/tiddlywiki/vanilla tiddler, which contains all the shadow tiddlers for the vanilla theme.
  2. Rename the tiddler and all of the contained shadow tiddlers to preserve this version of the vanilla theme, relative to the themes I've designed to use it as a base.
  3. Add my stylesheet to the end as a shadow tiddler entry, along with the relevant author, title, etc., data.
  4. Rename the cloned $:/themes/tiddlywiki/vanilla tiddler something relevant to the theme, change the description in the data entry areas at the bottom of the tiddler and add my name as one of the authors.

Would this work? I just wanted to make sure that I'm not missing anything before I do this. Is there a better way than what I'm thinking? Or, is this okay?


Thank you for any guidance you can provide. I am not sure if I will release these themes for others to use, but I was thinking of it and doing this would be a necessary step before releasing it for others to use.


Kind regards,

Hiru

Riz

unread,
Nov 21, 2016, 12:21:45 AM11/21/16
to TiddlyWiki


Hi Hiru,

I was hoping someone more knowledgable will come along and answer this question. Well, that did not pan out. So here is my answer. Remember, I have a very limited knowledge and 3 month old experience with TW, so take my pointers with a grain of salt.



I've created several fully-featured themes for TW5.

Fire of all, this is exciting. TW with all its glory, seems to have forgotten that people do weigh in optics and choices when it comes to  the software they use. I have been working on some themes myself so that I can present TW to mint community.




This is my thought for how this could be done:

Well it can be done in an easier way. You have created the theme - that is the tough part, now packing it to a plugin, leave it to the awesome tinka, god bless the soul that created this. I will outline the steps. (It might be over-detailed for you, but I hope it helps a someone else who might not have your experience)
Here is the steps

  1. Create a copy of your TW file.
  2. Drag and drop tinka to your copy from the plugin tab here:  http://tid.li/tw5/plugins.html#%24%3A%2FControlPanel
  3. In your Wiki, go to Control Panel > Tinka Plugin Management > Create New Plugin. The creater has nicely explained all the steps needed to pack it into a plugin. Remember to set plugin-type to theme.
  4. Here is the answer your question. To have vanilla as a base for your theme, just add "$:/themes/tiddlywiki/vanilla" to the field called "Dependents".
  5. Filter and add your stylesheets.There is no need to add the vanilla base or other parts of vanilla.
  6. Finally pack it, refresh your wiki, and you will have your theme listed in the theme switcher, along with other themes.


Here is a couple of pointers I learned the hard way.

1. The theme plugin is different from other plugins. The shadow tiddlers of theme plugins are actually deleted when you switch the theme. Now this is not a problem usually, but here is a scenario. You want to let your user change the main color of the theme. User changes it once, for eg, to red color. Later user switches the theme goes around and finally comes back to your theme. Problem is, since the theme tiddlers are recreated from scratch, all the settings made by user for your theme is lost. User has to go to control panel and modify the settings all over once again -everytime when he switches the theme.

The possible solution for this issue is this - store the user settings in a temporary tiddler outside the theme, which will be automatically created as and when user changes a default theme setting. Of course user must be presented with option to remove these state-tiddlers once they decide to uninstall the theme completely.

A second possible solution, which is upto the core developers, is to let the theme tiddlers be "Disabled" somehow than deleted. Would be nice to have it, not a pressing need I admit

2. Once you pack it to a plugin, inspect your theme all over again. There are certain rules in vanilla base that has !important attached to it. Plus there will be  some properties which will override your rules because it is more specified. Then there are unknown forces at play. Find those rascals, rule them out.

3. More of a request than a pointer. I hope to see more mobile responsive themes for TW. Hope yours is one of them.


I am not sure if I will release these themes for others

Please do. People keeping their solutions to themselves is sad. I for one would definitely like to have a look

Hiru Yoru

unread,
Nov 23, 2016, 2:51:26 AM11/23/16
to TiddlyWiki
Hi, Riz,

Thank you very much for your reply! I really do appreciate the details as it helps me to make sure that I've done things correctly. I'll go through the steps that you mentioned as soon as I get a chance.

I also appreciate your encouragement on releasing the themes I've made. They're not completely tested and I'd still like to make some changes to them before I'm completely satisfied -- I'm thinking of redesigning the svg iconset to be more minimalistic and abstract, for example. But, it is very nice to know that others would be interested in seeing them when I'm done. :)

Thank you again for your help!
Hiru
Reply all
Reply to author
Forward
0 new messages