Alien Night Theme - A free Dark Theme for Discourse

theme-full
(Daniela) #7

After few days I can confirm that this bug is fixed by deleting href="#" from the Html code, e.g.

  <a class="theme-switcher-attr theme-switcher-light">Light</a>
  <a class="theme-switcher-attr theme-switcher-dark">Dark</a>

If anyone is interested I changed the position and shape of the buttons making them “fixed” on the page, so users can change from dark to light (or viceversa) without going back to top.

On CSS I add:

#top-navbar {
    position: fixed;
    top: 90px;
    left: 0;
    z-index: 90000;
    width: 70px;
    overflow: hidden;
    margin: 0;
    text-align: center;
    box-shadow: 0px 0px 4px #070708;
    border-radius: 0px 10px 10px 0px;
}

according to my Html code.

and this line (both here .theme-switcher-light and here .theme-switcher-dark) to make the round buttons
border-radius: 100%;

In Html/Top:

<div id="top-navbar">
  <span class="theme-switcher">Tema:</span>
  <a class="theme-switcher-attr theme-switcher-light"><i class="fa fa-sun-o fa-lg"></i></a>
  <a class="theme-switcher-attr theme-switcher-dark"><i class="fa fa-moon-o fa-lg"></i></a> 
</div>

I preferred to use the FontAwesome’s icons instead of a text for buttons.

3 Likes
(B Iggy) #8

Hey @Trash,

just today I got feedback from the community regarding this too so I wanted to tackle it. Thank you for your fix. Will try it out. Nice to see it in action by someone else :slight_smile:

1 Like
(Alan Lehman) #9

Thanks for the terrific theme and switcher. This is perfect for my astronomy club.

Question - the background of the header bar (I’m using the default bar for now) does not change color when the dark theme is selected. It stays at the default white. Can the script be modified to include changing the header?

Thanks,
Alan

(Daniela) #10

You don’t need to modify the script, but add some lines on your css:

html.dark .d-header {
    background: #1c1c1c;  /*change it with the hex color you want*/
}

to change the background color

Instead, to change the color of the title (if you need) add somenthing like this:

html.dark .extra-info-wrapper .topic-link {
    color: #ffffff;  /*change it with the hex color you want*/
}
3 Likes
(Alan Lehman) #11

The lines for the header work perfectly. Thanks!

1 Like
#12

Hi there @Trash and @B-iggy !

I’m trying to apply your brilliant dark theme with switch bar, but I’m afraid that I messed up something…
Dark theme is working, also I can se the switch buttons, but they are just not working… Also colour is fixed to white.

I’m not really sure where should I paste the HTML code (sorry about that, I’m greenhorn in that matter).
Should I put it in Head or Body? Or in all of it?


Thanks!

(B Iggy) #13

Hey @Pawel_Kosiorek,

glad you like my theme! :slight_smile:

You only showed the html code and I guess the CSS is right. But did you apply the JS also in the head?

This code here:

https://github.com/B-iggy/discourse-dark-theme/blob/master/alien-night-theme--theme-switcher.js

Needs to be put in the section (Common).
The HTML goes to the “After Header” for Desktop and Mobile independently since they are a bit different.

1 Like
#14

Hi! Thanks for reply!
Now I can switch between Dark And Darker :smiley:
This is happening when I’m clicking to the moon:

And this is after click to the sun:

I think it’s related to naming of dark and light theme?

(Sam Saffron) #15

@B-iggy I would like to move this to the #plugin:theme , was wondering if you can orgnaise the the theme per:

5 Likes
(B Iggy) #16

Hello @sam

thank you very much for this opportunity - I feel honored :slight_smile:

I have reorganized all files and made it ready to use over native themes.
I updated / cleaned up everything and should be ready to go :slight_smile:

Thanks again!

Iggy

5 Likes
(Sam Saffron) #17

Cool, moving this to the theme category please update the first post :full_moon_with_face:

4 Likes
#18

Hi!
After your update everything works just fine! Congrats!
I found just one minor bug, from time to time switcher just stops working. There’s no effect when you’re trying to change from one to another theme. Site refresh helps.

One more thing, is it possible to change colour of top of the page and the switcher to night mode, when it’s switched to night mode :wink: Now it’s white on night mode.

(B Iggy) #19

Hey @Pawel_Kosiorek,

glad it worked with the native theme installation :slight_smile:
I will check why it is sometimes not working. Guess some internal JS call conflicts.

Yes, since I am using a background image for the header I left it accidentally white - will fix it.
Will adjust the color for the theme switcher too.

4 Likes
(grahamtrump) #20

Love it!!!:kissing_heart:

1 Like
(B Iggy) #21

@here Keep in mind that the #4 post is not up to date anymore.

I’m using now a complete new method for the Theme Switcher. It’s nicely put in the Discourse Header now :slight_smile:

(hopefully it has no issues with other Discourse Header components)

#22

Could you share that switch as a seperate theme component? I’m looking for this feature for months.

1 Like
(B Iggy) #23

Hey @Anatolia

I tried my best to make it happen :smiley:

Go here:

3 Likes
#24

I added to our forum. Thank you so much :slightly_smiling_face:

1 Like
(Daniela) #25

There is something wrong in the header when you open the hamburger menu:

A part of the menu moves to the top right and partially covers the buttons on the header

However great rework!

5 Likes
(B Iggy) #26

Back from vacation. Sorry for the delay!
I fixed it now :slight_smile: (legacy from my own sub theme header component)
Thanks for the report!

3 Likes