Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
FSpark opened this issue Oct 12, 2022 · 18 comments
Closed

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

FSpark opened this issue Oct 12, 2022 · 18 comments

Comments

@FSpark
Copy link

FSpark commented Oct 12, 2022

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
Copy link
Owner

donmor commented Oct 12, 2022

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

@FSpark
Copy link
Author

FSpark commented Oct 12, 2022

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
Copy link
Owner

donmor commented Oct 12, 2022

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
Copy link
Author

FSpark commented Oct 12, 2022

Yes, like this:
Screenshot

lightBar in

if (MainActivity.APIOver29 && wv != null) wv.getSettings().setForceDark(lightBar ? WebSettings.FORCE_DARK_OFF : WebSettings.FORCE_DARK_ON);
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
Copy link
Owner

donmor commented Oct 12, 2022

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

@donmor
Copy link
Owner

donmor commented Oct 12, 2022

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

@FSpark
Copy link
Author

FSpark commented Oct 12, 2022

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
Copy link
Owner

donmor commented Oct 12, 2022

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
Copy link
Author

FSpark commented Oct 12, 2022

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
Copy link
Owner

donmor commented Oct 12, 2022

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

@FSpark
Copy link
Author

FSpark commented Oct 12, 2022

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

@donmor
Copy link
Owner

donmor commented Oct 12, 2022

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
Copy link
Owner

donmor commented Oct 12, 2022

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
Copy link
Owner

donmor commented Oct 12, 2022

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
Copy link
Author

FSpark commented Oct 12, 2022

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

@donmor
Copy link
Owner

donmor commented Oct 12, 2022

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
Copy link
Owner

donmor commented Mar 10, 2023

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

@donmor donmor closed this as completed Feb 12, 2024
@linonetwo
Copy link
Contributor

See Jermolene/TiddlyWiki5#7830

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants