nightmode icon indicating copy to clipboard operation
nightmode copied to clipboard

Add classes to body for dark and light mode targeting

Open aybanda opened this issue 11 months ago • 1 comments

Fixes #77

Changes proposed in this pull request:

  • Added fof-DarkMode and fof-LightMode classes to the <body> tag when switching themes in the switchTheme.ts file.
  • This change allows for better targeting of styles specific to dark and light modes, improving readability and user experience.

Reviewers should focus on:

  • The logic for adding and removing classes from the <body> tag.
  • Ensuring that the changes do not affect existing functionality.
  • Feedback on whether the class names align with the project's naming conventions.

Confirmed

  • [x] Frontend changes: tested on a local Flarum installation.
  • [ ] Backend changes: tests are green (run composer test).

aybanda avatar Dec 30 '24 10:12 aybanda

Haven't tested this, but it'd probably need to be set in setTheme instead.

However, I think it's best not to bother as

  • this is already possible to do with LESS variables (https://discuss.flarum.org/d/21492-friendsofflarum-night-mode/405)
  • auto night mode will be built in for Flarum 2.0 once that is released

Since it is already possible to target the styles, I don't think this is necessary.

dsevillamartin avatar Dec 31 '24 18:12 dsevillamartin