Add dark/light theme toggle to docs.layer5.io
Current Behavior
The Layer5 Docs website (https://docs.layer5.io) does not have a dark/light theme toggle option.
Other Layer5 websites like the Kanvas page already include this feature.
Desired Behavior
Add a dark/light theme toggle to the Layer5 Docs website so users can switch between light mode and dark mode.
Implementation
1.Add a theme toggle button in the navbar/header. 2.Reuse the existing theme toggle design from other Layer5 websites if possible.
Acceptance Tests
1.Theme toggle is visible in the navbar. 2.Users can switch between dark and light themes. 3.Works properly on desktop and mobile.
Mockups
Current Docs Website (No theme toggle)
https://github.com/user-attachments/assets/5e77fc76-2216-49f5-930a-44ad1f1aeee9
Reference from Kanvas Website (Theme toggle available)
https://github.com/user-attachments/assets/277f6910-f353-4f45-bf4d-09791fe19feb
Contributor Guide and Resources
- 📚 Instructions for contributing to documentation
- 🎨 Wireframes and designs for Layer5 site in Figma (open invite)
- 🙋🏾🙋🏼 Questions: Layer5 Discussion Forum and Layer5 Community Slack
Hi maintainers, I’m interested in working on this enhancement. Could you please assign this issue to me? Thanks!
Hi @gitAash, thanks for suggesting this.
This sounds like a useful enhancement. Please feel free to raise a PR for it, and we will review the implementation from there. Try to keep the change minimal, reuse the existing Layer5/Kanvas theme toggle approach if possible, and make sure it works properly on both desktop and mobile.
Thank you @KatalKavya96,I'd be happy to work on this. I'll keep the changes minimal, reuse the existing theme toggle approach where possible, and ensure a consistent experience across desktop and mobile. I'll submit a PR soon.
Hi! Thank you @KatalKavya96 for assigning this issue to me. I spent some time working on it, but I'm currently facing some hugo server and laptop issues and haven't been able to verify the changes. Rather than keeping the issue blocked, I think it would be better if someone could take it forward. I'd be happy to contribute to other issues in the future. Thank you for your understanding!
@KatalKavya96 Since this issue is currently open again, I would like to take it up and work on it. Please assign it to me.
@11yashiagrawal are you working on this issue
Yes, i'm working on it.
@11yashiagrawal Are you really working on it because it is not a work of 1 week if you are not intrested then let other to take this issue @NSTKrishna please look into this
@dhruveshmishra I understand your concern, but let’s wait for 2–3 more days before reassigning this.
@11yashiagrawal has confirmed that she is working on it, and since she has already spent some time understanding and implementing the change, it would be fair to give her a little more time to raise the PR or share an update.
@11yashiagrawal please keep us posted on the progress whenever possible.
@KatalKavya96 okay
@NSTKrishna @KatalKavya96 Since the issue requires adding a theme toggle button to the website as present in the other layer5 websites, it requires us to create the complete website almost in the light theme as well. We need to create light theme colours etc for all the text, svgs and other elements and maintain the colour as well as style consistency across other layer5 websites.
A good way to do this so that it stays scalable and maintainable is:-
• Create global theme objects and dynamic properties just like how it works for layer5.io website • Theme Manager script that assigns styles based on selected theme • Change the existing hardcoded styles in the elements to the dynamic properties ensuring smooth transition
Since Hugo framework websites render static html pages and does not work like React components dynamically, we will have to edit every element separately in each file and also create light-themed versions of each svg or images used there.
I have been moving ahead with this approach currently and since this requires to handle each element precisely in detail, this has been taking time.
Just needed a quick heads up if my direction of work is correct and I should keep working in the same. Would raise a PR soon!
@11yashiagrawal Thanks for the update and for explaining the approach.
The direction looks reasonable, especially moving toward reusable theme properties instead of hardcoded styles.
- Please try to keep the first PR minimal and focused, covering the global theme setup, toggle behaviour, and key visible sections first.
You can continue in this direction and raise the PR once you have a working version. We can review the details there.