Open kookma opened 3 years ago
@BurningTreeC Is this something you might want to tackle? Even if it doesn't make it into the core right away, I think it would be a nice plugin.
JD has already done most of the groundwork in #4769
@saqimtiaz we'd need a dark / light equivalent for every theme... I don't know if we do. But I'd like to tackle this, yes
@BurningTreeC I was thinking we just let the user directly choose a dark and light palette as part of a config option.
Good idea @saqimtiaz !
@BurningTreeC do have a look at JD's implementation in #4769, some good ideas in there
Just to complicate things, there is a media query for detecting the users preference for dark mode vs. light mode:
https://css-tricks.com/dark-modes-with-css/
$:/core/modules/info/platform.js could use Window.matchMedia()
to set an info tiddler.
$:/core/modules/info/platform.js could use Window.matchMedia() to set an info tiddler.
@Jermolene, that's a nice idea. I already did so, but now I need some ideas how to make use of it
@Jermolene, that's a nice idea. I already did so, but now I need some ideas how to make use of it
I get the impression that people like websites that automatically adapt to the prevailing display mode, so I think that would be a good starting point. We should also listen for changes using the technique shown in https://flaviocopes.com/javascript-detect-dark-mode/
Having said that, we may want to keep this back until after v5.1.23...
yes @Jermolene, I also want to keep this back until after v5.1.23
I think it would be good to give this a run as a plugin, or an early part of 5.1.24-prelease to get user feedback.
@Jermolene - I tried using window.matchMedia
and listening for changes on the preferred color scheme and I got it working. I currently do this in startup.js, set a state tiddler (like $:/state/dark-mode) to true or false on startup and change it when the preferred color scheme changes.
In the colour macro then we can do <$transclude tiddler={{{ [{$:/state/dark-mode}match[true]then{$:/config/DarkMode/palette}] ~[{$:/config/LightMode/palette}] ~[{$:/palette}] }}} index="$name$">
and users can configure their dark/light palettes through the ControlPanel
I think switching between themes is already a button, that can be used that way. Do we really need complex CSS?
I think switching between themes is already a button, that can be used that way. Do we really need complex CSS?
The rationale for a modal switcher is that it is outside the main page container in the DOM, and hence can't be disrupted by a faulty page layout.
I love that there are system/media-query hooks to use. I implemented this as a simple light/dark toigle sidebar button in my silat (martial arts) wiki: https://silat.chronicles.wiki
(Part of my PageTools plugin that I have to rework now that we have toggle[] and cycle[]. I also got a couple of good svgs to use there.)
@Jermolene , I don't want to create a new issue for this question: why does the framed editor extract the background-color from the currently used palette and set it for the iframeNode and domNode, if we can style them through a Stylesheet, which makes it also easier to modify styles... ?
Hi @BurningTreeC the issue is that we can't style the contents of the iframe from the main stylesheet, so we style an off-screen text area and then copy the styles one by one.
Hi @Jermolene, thanks for the explanation, but I was fiddling around by commenting out the lines that set the background-color to the iframeNode and the domNode and still it works fine styling them via a Stylesheet
Hi @BurningTreeC I think you might have authored the lines in question: 14003b0e88fa8378af71f499700c648fe2a3f3d7
Hi @BurningTreeC I think you might have authored the lines in question: 14003b0
Ouch, that was a mistake!
Hi @BurningTreeC I think you might have authored the lines in question: 14003b0
@Jermolene, I'll revert this with this PR here
@Jermolene, I'll revert this with this PR here
Thanks @BurningTreeC
Folks,
Beyone simple nioght day switching - I support that.
Using this filter invert gives me the clue I was looking for, a way to get Icons to be given contrasting colors. Without even knowing the color one can use its rotated hue.
Somehow I feel this feature could be built into svg display or designs to allow a primary colour to be selected freely knowing its background as an example will contrast. My interest is to allow designers to use alternate colors on available icons when adding a new button feature, but we always have the issue of "other themes", changes in background color etc... _ This may also apply to svgs from the icon source Mohammad shared recently
All I ask is when investigating the mechaisium for night/day please also consider it as a way to ensure complementary colors and please avoid compromising future possibilities.
Thanks Tony
Post script, eg using traffic light colors to indicate button status etc...
@kookma -- I think the Palette-Switcher and Palett-Watch plugin can handle that
I think this one can be closed.
The OP asks to add the feature to the Core! Yes, there are several plugins around to do that, Like Notebook theme, Shiraz, ...
I'd be inclined to keep this open. Our support for dark mode is still very rudimentary, and I would regard the OP as a reasonable request
Tiddlywiki 5.1.23 has a bunch of wonderful new features. With the advent of toggle operator and the nice working dark palettes, yet the current trend for having toggle dark/light on many websites, I may recommend