Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 4 years ago

Social Media Dashboard with prefers-color-scheme and JS toggle

Dusan•700
@DEmanderbag
A solution to the Social media dashboard with theme switcher challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello everyone,

In this project for the initial load, I've used prefers-color-sheme that would trigger and respond to the theme of your computer. Every time when you change the theme on the computer website should also change color.

The approach above does not work as soon as the toggle was pressed at least once, because the toggle loads new CSS version of the light or a dark theme respectively. The issue that I've come across with this approach is that the link tag will be loaded every time, I was not sure how to fix that so if you have any suggestion just let me know :)

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Dusan's solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License