Theme-Switcher-Komponente

[deprecated]

Hallo Discourse-Community,

aufgrund vieler Anfragen stelle ich eine Theme-Switcher-Komponente vor, die aus meinem Alien Night Theme gekapselt wurde.
Derzeit wechselt das Theme beim Drücken des Buttons in ein Dark-Mode-Theme.

Später könnte ich vielleicht eine Einstellungsseite implementieren, auf der Sie Ihre eigene globale CSS-Klasse definieren können, in die Ihr Theme wechseln soll.
Oder einfach zwischen den ersten beiden Themes hin- und herschalten, die Sie den Benutzern zur Auswahl angeboten haben…

Installation & Download

Vorschau

Wenn Sie Feedback oder Fragen haben, lassen Sie es mich einfach wissen :slight_smile:

23 „Gefällt mir“

You can let admins select which themes they want to use. We have two different themes and each theme has it own dark mode.

When we click the switch to change light to dark, this component below should have change the logo’s color to light as the opposite. Now it doesn’t work with this switch.

https://meta.discourse.org/t/alternative-logo-for-dark-themes/88502

1 „Gefällt mir“

Ok, I’m not advanced in Discourse modding but I try to implement it.
Help from professional guys are appreciated :smirk: @Johani

Hmm, good point. Not sure how I can make a cross-component-compatibility-mode.
I’ll think about it.
Thanks for the first feedback so far!

3 „Gefällt mir“

Defining the themes in the settings is possible, but will complicate things. The hamburger menu theme selector is a good working example of how you’d change the theme based on ID.

https://github.com/discourse/discourse-hamburger-theme-selector/blob/master/common/header.html

5 „Gefällt mir“

I had some time tonight, so I worked on modifying the hamburger theme selector to toggle between two themes: Header Theme Toggle. Thanks so much for inspiring this with your theme @B-iggy!

11 „Gefällt mir“

Good Morning @awesomerobot ,
oh wow, that was quick :smile:
Much better than I could have done anyways.

I think this topic here is obsolete/redundant then :thinking:

5 „Gefällt mir“

Not necessarily, there are some benefits of switching the CSS rather than switching the entire theme. Everything’s self contained and you don’t need to fully refresh for all the changes to take effect.

7 „Gefällt mir“

Your component might be better with some improvements. I hope you continue to develop :handshake:

2 „Gefällt mir“

Awesome plugin! How can i force it to be in the first place (next to the search bar)?

1 „Gefällt mir“

Good Morning @szergely
glad to hear you like it :slight_smile:

Instead of changing the code on your end I think it makes sense to have it next to the search icon per default.
So I pushed this change now. Let me know if it’s fine :slight_smile:

3 „Gefällt mir“

Yes now its there! Thank you for the fast support, i really like this light/dark button! :heart_eyes:

3 „Gefällt mir“

Unfortunately I can’t edit my own post at the top :roll_eyes:

Hence the important notice that the preview link got updated:

I pushed a new version and the regular “Update to Latest” was broken, so I reinstalled it :roll_eyes:

2 „Gefällt mir“

Made it wiki, you should be able to update it now :hugs:

5 „Gefällt mir“

When using Dark mode with Sam’s minimal theme, it looks like this:

Also is there any workaround to add an alternative logo? My current one is not readable on dark bg, hence I want to add a inverted one for the dark mode

My theme has lots of hardcoded colors and only works properly with a light color scheme. Open to fixing this but for now it does not work right in dark mode.

2 „Gefällt mir“

Hast du schon mal darüber nachgedacht, den unteren Bereich kleiner zu gestalten? Bei der Verwendung zusätzlicher Komponenten nimmt der Header viel Platz in Anspruch. Zum Beispiel gefällt mir der Dark-Mode-Button in diesem Ghost-Theme oben rechts:

Kann ich das auch für das Material-Design-Theme verwenden?

Gibt es eine Möglichkeit, das Plugin vom Header in das Dropdown-Benutzermenü zu verschieben?

Auf einfache Weise geht das nicht, du bräuchtest eine neue Komponente.

1 „Gefällt mir“