agamjotsingh18 / codesetgo

Open Source Website of CodeSetGo
https://codesetgo.netlify.app/
MIT License
76 stars 236 forks source link

refactor: encapsulate theme setting logic into functions 🪄✨ #693

Open 0xabdulkhalid opened 11 months ago

0xabdulkhalid commented 11 months ago

Description:

Proposed Changes:

  1. Encapsulate the dark mode logic into functions: The existing code will be refactored to encapsulate the theme setting logic into functions. This will improve the readability and make the code easier to understand.

  2. Use constants for theme values: Instead of using hard-coded theme strings, we will introduce constants for the theme values to avoid repetition and enhance code clarity.

  3. Optimize code for setting and toggling themes: The functions will be designed to handle setting the appropriate class and updating UI elements based on the selected theme. The toggleTheme() function will be responsible for toggling between light and dark mode.

  4. Improve theme initialization: The theme initialization process will be streamlined to handle user preferences or default to the dark theme if no preference is found.

Expected Benefits:

0xabdulkhalid commented 11 months ago

Hey there @agamjotsingh18 👋🏻

Please make sure to assign this issue to me to make the work done, Thank You!

agamjotsingh18 commented 11 months ago

Sure @0xabdulkhalid