A color palette switch plugin

88 views
Skip to first unread message

Pengju Yan

unread,
Jan 28, 2024, 4:22:13 AM1/28/24
to TiddlyWikiClassic
Hi,

Very happy to see 2.10.0 released, and also very happy to see the ColorPaletteDark enclosed. I've been working on tweaking my own dark mode color palette one year back. Finally we get an 'official' one now!

Yakov also developed an amazing DarkModePlugin. I used it a bit and found that it's behavior of automatic switching to dark mode on startup is not what I want. So I developed another plugin SwitchPalettePlugin where the user takes full control on what color palette to choose.

Hope it is useful to anybody else. Check here for a live demo with several color palettes enclosed: SwitchPalettePlugin on github.io.

This work was inspired by Yakov Litvin's DarkModePlugin. Many thanks!

Pengju

Yakov

unread,
Jan 29, 2024, 6:30:23 AM1/29/24
to TiddlyWikiClassic
Hi Pengju,

congratulations with your release! The palette looks very nice indeed, and also I appreciate your efforts to share with others!

Could you clarify why you decided to create a separate plugin? I mean, DMP allows you to edit ColorPaletteDark, so if you switch between light and dark modes, DMP is probably enough for you. Do you switch between more than 2 palettes during your work?

(also, your demo page starts autosaving → downloading TW on each palette switch, you may want to fix that)

Best regards,
Yakov.

воскресенье, 28 января 2024 г. в 12:22:13 UTC+3, yanp...@gmail.com:

Pengju Yan

unread,
Jan 30, 2024, 4:58:13 AM1/30/24
to TiddlyWikiClassic
Hi Yakov,

I remember I replied to your post here, but when I came back my reply just didn't show up. Did I 'small-replied' to you only, so it is a private post not showing publicly?

Two reasons for writing a separate plugin:

1. I just want to have multiple color palettes and switch between among them when I want to. For this task, DarkModePlugin is just not the tool for it, because it's binary nature.

2. DarkModePlugin will automatically switch back to ColorPaletteDark on startup, if my macOS system setting is 'dark'. This behavior is not what I want. I want my previous set color palette be persistent, rather than being switched back to the OS mode.

As for the autosaving behavior of the demo, I admit it is annoying. I can think of two options:

1. Add a checkbox option for the user to enable/disable autosaving. But it takes time.

2. Disable autosaving for the public demo plugin, but leave the autosaving version for me only. I don't think it is an ideal one.

Is there any better solution? Looking forward to your suggestions.

Pengju

Yakov

unread,
Jan 31, 2024, 10:45:32 AM1/31/24
to TiddlyWikiClassic
Hi Pengju,

you have initially replied via a private message indeed, that's why it wasn't shown here.

Thanks for sharing the considerations, I'll probably add an option to disable propagation of the OS setting in DMP (may help me, too, haven't thought about that).

Regarding the autosaving/downloading issue, I think, here's a sane approach that you can use as a quick fix:
  1. in your plugin, use autoSaveChanges instead of saveChanges: this is a better practice since it is more user-controlled thing (for instance, one using the download saving may want to save less often, and forcing them to save is not a very good idea);
  2. well.. that's it (by default, chkAutoSave is false), but you can make it more explicit: for instance, add a plugin which will do if(readOnly) config.options.chkAutoSave = false;
Best regards,
Yakov.

вторник, 30 января 2024 г. в 12:58:13 UTC+3, yanp...@gmail.com:

Yakov

unread,
Jan 31, 2024, 10:56:37 AM1/31/24
to TiddlyWikiClassic
PS In fact, I have one more suggestion: as I'm trying (although not very consistently yet) to build nice plugin explorability via the ExtensionsExplorerPlugin (now it works fine for plugin updating, but is not mature for plugin exploring), I'll be glad if you help me indexing your plugin:
  • as a simpler approach, you can create a PR to the EEP repo adding your plugin to the ExtensionsCollection directly;
  • if you are planning to release other plugins, you can create a collection and link it instead; but may be it'll be more reasonable to do so after releasing the next one (the thing is, it's best to publish a collection in a separate repo, here's an example).

среда, 31 января 2024 г. в 18:45:32 UTC+3, Yakov:

Pengju Yan

unread,
Feb 10, 2024, 5:45:26 AM2/10/24
to TiddlyWikiClassic
Hi Yakov,

Thank you very much for pointing me to autoSaveChanges. I have made the quick fix accordingly. People like to switch between multiple color palettes can have a try (no more annoying auto-downloading).

Pengju

Pengju Yan

unread,
Feb 10, 2024, 6:42:30 AM2/10/24
to TiddlyWikiClassic
Hi Yakov,

A small question here about the ExtensionsExplorerPlugin (EEP). What I wrote for the source slice my plugin is in the format of `[[SwitchPalettePlugin.js|https://github.com/PengjuYan/TiddlyWiki_SwitchPalettePlugin/blob/master/SwitchPalettePlugin.js]]`. Shall I revise it to be a plain url, i.e., `https://github.com/PengjuYan/TiddlyWiki_SwitchPalettePlugin/blob/master/SwitchPalettePlugin.js`?

Pengju

Yakov

unread,
Feb 12, 2024, 10:25:02 AM2/12/24
to TiddlyWikiClassic
Hi Pengju,

well, I suggest so. The thing is, if somebody installs you plugin by copy-pasting and adds EEP later, they won't get updates from you as the slice value is not a url. To avoid that, it would be reasonable to change the slice value to a bare url, although the current version is slightly more nice-looking.

I'll also accept your PR with a comment soon.

Best regards,
Yakov.

суббота, 10 февраля 2024 г. в 14:42:30 UTC+3, yanp...@gmail.com:

Pengju Yan

unread,
Feb 15, 2024, 10:17:47 AM2/15/24
to TiddlyWikiClassic
Hi Yakov,

Thank you for merging this plugin to ExtensionsExplorerPlugin! People can now get access to it through EEP.

Nevertheless, you can still find the demo and install it manually here: SwitchPalettePlugin on github.io.

Pengju
Reply all
Reply to author
Forward
0 new messages