donmor / Tiddloid

Tiddloid is an app to work with locally stored TiddlyWikis.
GNU General Public License v2.0
240 stars 11 forks source link

[Feature Request] Provides option to toggle light/dark mode #48

Closed FSpark closed 9 months ago

FSpark commented 2 years ago

I'm glad you've provided the ability to force a dark theme in version 2.3.1, but that feature is toggled with the system settings. However, I had already customized the dark theme in my TiddlyWiki file and enabling setForceDark() would cause color misalignment, so I would like you to provide the option for the user to fix the light/dark theme themselves.

PS: Thanks for bringing the legacy local loading option back!

donmor commented 2 years ago

You need a plugin to apply the theme of your wiki to the app. See FAQ :)

FSpark commented 2 years ago

Thank you for your reply, I have tried it, but I think you have misunderstood what I mean, the options in the plugin change the color of the system bar, my request is not to follow the system light and dark settings by default to enable setForceDark() of WebView , which is a new feature introduced in 2.3.1.

donmor commented 2 years ago

You mean applying force light/dark, but not setting theme color? Hmmm... someday I may update the plugin to add a light/dark only option :)

FSpark commented 2 years ago

Yes, like this: Screenshot

lightBar in https://github.com/donmor/Tiddloid/blob/0719cbcd38bfa99face7d015d6569bce3daea6b9/app/src/main/java/top/donmor/tiddloid/TWEditorWV.java#L1858 doesn't always seem to work, some themes are even just CSS and don't change the colour palette.

Wait.. why apply setForceDark() again to force darkness when a dark theme is detected?

donmor commented 2 years ago

setForceDark() applies on WebView. It has to be set separately.

donmor commented 2 years ago

In fact Tiddloid reads data from current palette, not theme. Themes and palettes in TiddlyWiki are set separately.

FSpark commented 2 years ago

Yes, I've read that source code, what I mean is that the page-background in TiddlyWiki is already dark, which means that TiddlyWiki is already in a dark theme at this time, and then applying setForceDark() will cause color misalignment.

donmor commented 2 years ago

Hmmmmmmm... I thought the WebView just notifies the page that should be in dark mode and renders background (if not changed by the page) and some widgets darkened... So you think the webview does something more than abobe, or it overrides the settings of the page?

FSpark commented 2 years ago

It is not as smart as DarkReader, as shown in the picture, you can also test it with a dark palette like SolarizedDark:

Normal:

Screenshot_normal

SetForceDark

Screenshot_Dark

donmor commented 2 years ago

Okay I may remove this line in next update since is not properly handled by TW.

FSpark commented 2 years ago

Well, this should have been a nice feature.. 😢

donmor commented 2 years ago

It's not a new feature XD... In the 1.x era there's a "Colorful Update" (1.4.0/lite 1.2.0) which introduced the tweak plugin and theme colors. The setForceDark() should have been an adaption to recent apis, but it seems to be a failure.

donmor commented 2 years ago

I'll remove setForceDark() until it is proved to work well with TW. Another attempt is to apply a patch to the tweak plugin, replacing the checkbox with a combobox to provide a third "Dark / Light" option, in addition to yes or no. The app also needs a minor tweak to work with it.

donmor commented 2 years ago

It's weird that on my physical device (a Redmi) the page is properly rendered... That's why I didn't see anything wrong, maybe XD

FSpark commented 2 years ago

Maybe it's because my system's WebView version (78.0) is too old... 😣

donmor commented 2 years ago

Hmmmmm... I just remembered once the page rendered incorrectly in avd, even the setForceDark() not present... Now I'm not sure to remove this line or not.

donmor commented 1 year ago

Does anyone still have problem? I may close this if no problem reported.

linonetwo commented 9 months ago

See https://github.com/Jermolene/TiddlyWiki5/pull/7830