1.3.0

  • Add option to always have a theme toggle button on the forum header, even when logged in

Updating

composer require fof/nightmode:"*"
php flarum cache:clear

1.3.1

The last update introduced a JS bug which is fixed in this version.

Use the update command for updating:

composer update fof/nightmode:"*"
php flarum cache:clear

The benefit being you can update all FoF plugins at once using:

composer update fof/"*"
php flarum cache:clear

Which is probably what most people would prefer to be doing

    Valeyard I would never include an "update all" command in official update instructions, for a few reasons:

    • More difficulty troubleshooting if an issue pops up after an update
    • Unexpected changes for the user if they have not read the changelog of the other extensions
    • Additional steps could have been suggested in the changelog of other extensions, like running migrations, executing a command or setting up new permissions

    Forum owners are of course free to manage updates in any way they prefer, but blindly updating extensions via Composer can be dangerous because Composer itself has no mechanism to help with required or suggested pre- or post- update steps.

    EDIT: as for the difference between require and update, in the context or a Flarum extension, require will actually update the requirement in composer.json if it isn't already *, while update will only constrain the version further down using the provided version. So while require vendor/package and require vendor/package:"*" save the version requirement differently, update vendor/package and update vendor/package:"*" have the exact same effect, making :"*" redundant.

    1.3.2

    This update fixes an ongoing issue with Night Mode where stylesheet assets would not recompile on every request when Flarum was in debug mode. This issue has now been fixed. This issue mainly affects extension developers rather than production forums.

    Updating

    composer require fof/nightmode:"*"
    php flarum cache:clear
    9 days later

    1.3.3

    Updating
    composer require fof/nightmode:"*"
    php flarum cache:clear
    a month later

    I'm already on flarum 1.4.0, has anything changed in how the dark mode styles should be handled? With the update my dark styles are shown in both modes (light/dark).

      IanM Upgraded to Flarum 1.4 and updated Night mode, now my footer is broken means the style CSS I have to have blank footer when dark mode is off and black when dark mode is on is no more working.

      Darkle I think I have the same issue: forum footer template broken due to style changed. Now I need help on how to fix on my two communities. Hope in any help. Thank you!

      The CSS that now is no more working:

      body when (@config-dark-mode =true) {
          div#footer {
              border-color: #0b0c0f !important;
              background: #0b0c0f !important;
          }
      }

      Looking at a few issues that have come up, I have removed the 1.3.4 release. Forums could update to it without being on Flarum 1.4, which would also break functionality -- now they can stay on Nightmode 1.3.3 with no issues.

      If you're planning on updating to Flarum 1.4, be aware that Nightmode will error until an update is live.

      6 days later

      Hi,
      Is there any way to customize some of Night Mode styles without editing extension's files directly?
      I think if we had a area in extension's setting page in admin panel to enter custom styles, that would be nice

        masihdindar

        In your Custom Styles section in the admin panel, you can define dark and light styles.

        E.g.,

        .MyClass {
          & when (@config-dark-mode = true) {
            // dark styles...
          }
          & when (@config-dark-mode = false) {
            // light styles...
          }
        }

        This works with normal Less syntax too, so you can do

        .MyClass {
          & when (@config-dark-mode = true) {
            &--thing {
              // dark styles...
            }
          }
        }

          masihdindar custom styles can be added {YOUR_FORUM_URL}/admin#/appearance

          To add a style only for dark mode:

          @config-dark-mode: false;
          
          #app when (@config-dark-mode = true) { ... }
            4 days later

            I have a issue when changing to dark mode, it didn't happen before Flarum 1.4, it happens only with Firefox, when changing to dark mode all the js breaks, I get this in the console:

            The resource from "https://example.com/assets/forum-dark.css?v=f5b8fefc" was blocked due to MIME type ("text/html") mismatch (X-Content-Type-Options: nosniff).

            I haven't touched anything, I see that with https://discuss.flarum.org/ it doesn't happen, maybe it happens when adding custom styles for dark mode?

            I'm trying to use Night Mode and override some core less variables (only some of them, not all).

            I tried to do it this way, looking at how things are done in flarum/core:

            .define-my-colors(@config-dark-mode);
            .define-my-colors(false) {
            	@my-body-bg: red;
            }
            .define-my-colors(true) {
            	@my-body-bg: green;
            }
            
            @body-bg: @my-body-bg;

            But apparently something is wrong and this doesn't work as expected: I get an error: variable @my-body-bg is undefined in file /opt/flarum/extensions/flarum-my-ext/resources/less/forum.less in forum.less on line 9... Any idea why I cannot define variables like this ? Seems like in flarum/core this exact same way of defining variables works seamlessly !...

              iPurpl3x where did you define your vars? How are they added to the less compilers?