FriendsOfFlarum / nightmode

🌙 Turn off the lights!
https://discuss.flarum.org/d/21492-friendsofflarum-night-mode
MIT License
33 stars 22 forks source link

Bad color visual in dark mode: code #65

Closed PeopleInside closed 1 year ago

PeopleInside commented 2 years ago

Bug Report

Current Behavior

In Dark mode some strings of the code are not visible.

See here: https://discuss.flarum.org/d/21492-friendsofflarum-night-mode/365

n-peugnet commented 1 year ago

You might be interested in the extension I made that fixes this issue (among other things): CLUB1 Server Side Highlight.

It provides the following advantages:

  1. The highlighting is done on the server so it is not up to the clients to do it.
  2. The server uses the cache to save highlighted blocks to only do the processing once.
  3. It works without any JS so even on the worst web browser the highlight will be there and there is no delay before the highlighting is applied.
  4. The theme adapts itself to the "dark mode" setting of Flarum.
  5. It works even with BBCode extension disabled.
  6. Admins can choose the highlight theme for both "Light" and "Dark" Flarum variants.
  7. Admins can download highlight themes with highlight:download Flarum console command.
  8. It is compatible with fof/nightmode >= 1.5.2 by switching the highlight theme accordingly.
PeopleInside commented 1 year ago

Thank you, but why this extension fix only new post? Once is active will edit how message are posted so this is the reason I read the changes will be applied only to new comments? :)

n-peugnet commented 1 year ago

Thank you, but why this extension fix only new post? Once is active will edit how message are posted so this is the reason I read the changes will be applied only to new comments? :)

Yes, this extension applies the highlight in the backend. It modifies the parser, who is responsible for analyzing the posts when they are sent. This is to minimize the amount of processing when reading the posts.

As recommended, you can use php flarum chore:reparse from the club-1/flarum-ext-chore-commands extension to parse again all previous posts. Note that other extensions might also affects the parser, so it could change more than just the code highlighting on old posts.

dsevillamartin commented 1 year ago

Closing since this extension isn't responsible for what dark mode looks like, only activating it.