Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 8806

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 60k
Author
Asked: November 28, 20242024-11-28T04:34:14+00:00 2024-11-28T04:34:14+00:00

Custom Themes and Dark Mode Release

  • 60k

Well, this is it! Exciting stuff I know. Both issues on the integration of dark mode and custom themes have been completed! This marks the end of the 3 post series outlining my experience implementing these 2 functionalities.

However, it doesn't feel right to not add a little more information on my experience with the custom theme functionality, so here are some notes I wrote down while reimplementing it which didn't make it into the previous post:

Unreleased Notes

My progress on the custom themes has been going great! Right now I'm planning on adding 2 new themes, a Gameboy theme, that will work off the limited palette of the original Gameboy and a Pokemon Home theme, based on the colours used in the Pokemon Home app.

Gameboy Colours

Gameboy palette example

Home Ref 1

Home Ref 2

Pokemon Home reference images

My prediction was correct, using the scraped data would've been a lot for the web app, even though I spent quite some time gathering all the portraits for the Pokemon, I deleted the data and found an alternate way to handle everything: states and ID tracking.

See the entirety of the styling right now is based on a dropdown, so essentially, when a style is changed:

<select id="themeSel">     <option value="">Light</option>     <option value="dark" selected={theme == "dark"}>Dark</option>     <option value="gameboy" selected={theme == "gameboy"}>Gameboy</option>     <option value="home" selected={theme == "home"}>Pokemon Home</option> </select> 
Enter fullscreen mode Exit fullscreen mode

Tracking the value of the select component "themeSel" along with a state variable "theme" enabled me to track the selected theme directory-wide by simply referencing the ID of the dropdown. This lets me do fun things like dynamically change the styling of the background and other areas like the cards easily when using a custom theme. This is a pretty big change over the simple toggle I had previously implemented for dark mode.

Using a reference to the dropdown also allows me to dynamically make API calls, as opposed to storing all that data locally. If the Gameboy theme is selected, I want to be able to change the official art portraits to the pixel-based sprites seen in most of the games. Of course, if the home theme is selected, I want to use the home model to show off all the Pokemon. I already have an idea as to what needs to be done for the home theme because of some reference pictures taken from the Nintendo store's site. That's all for the update!

Anyways…

So yes, both functionalities are implemented and fully functional. It was super fun implementing the new themes as it almost required me to create a skeleton theme manager that can be used to implement any number of new themes! I ran into a few problems, mainly with how I handled storing all the themes, which was promptly fixed up by reducing the scale of what I was doing. For example…

    const toggleDarkMode = () => {       const newTheme = !isDarkMode;         const newTheme = !isDarkMode;         setIsDarkMode(newTheme);         setIsHomeTheme(false);         setIsGameboyTheme(false);         localStorage.setItem('isDarkMode', JSON.stringify(newTheme));         localStorage.setItem('isHomeMode', JSON.stringify(false));         localStorage.setItem('isGBMode', JSON.stringify(false));     }; 
Enter fullscreen mode Exit fullscreen mode

this chunk of code handled everything JUST for toggling dark mode… yeah it's ugly, and it made me realize almost immediately after creating this abomination that I should scale back on how I handle it. Now it's handled in a much neater fashion;

    useEffect(() => {         const savedTheme = localStorage.getItem('theme');         if (savedTheme !== null) {             setTheme(savedTheme);         }     }, []);      const handleThemeChange = (newTheme) => {         setTheme(newTheme);         localStorage.setItem('theme', newTheme);     }; 
Enter fullscreen mode Exit fullscreen mode

these 2 do it all! the useEffect is mainly just for extracting the theme when loading the site so that it remembers what theme you had stored in a previous session, whereas the handleThemeChange, works its magic when you change the theme while using the site. There's a lot more to it, but the bread and butter is right here, and it was a ton of fun to figure out and implement!

Completing my goals

It took a lot of time (mainly because of my overcomplication with the implementation) but it was a fantastic experience to work on these features. Dark Mode is interesting because working on it made me realize that it can be as easy or as hard as you want it to be to implement. It's one of these features where there are almost a million ways to implement it but luckily I realized a bit after overdeveloping it that there was a much better and neater solution. Custom Themes are almost the same, I spent a good couple of days crafting a comprehensive list using a mixture of web scraping and manual formatting only for me to realize how benign an implementation like this is for such a feature. Of course, it would've worked, but at what cost? Working on the dark mode feature gave me a good idea as to how I would need to handle the custom themes, and working on custom themes gave me an excellent idea as to how custom theme frameworks are built. Tailwind CSS made all of this a breeze by allowing me to create custom colours that could be easily referenced.

The PRs and issues can be found below, as well as pictures of the final look for all the themes!

Issues

GitHub logo add dark mode (my eyes hurt) #12

lstuma avatar

lstuma posted on Oct 16, 2023

View on GitHub

GitHub logo Custom Themes #22

Namatuzio avatar

Namatuzio posted on Dec 04, 2023

Hey again @TheShiveshNetwork, I would like to add custom themes to the site, if you want I could also package the dark mode stuff into there!

View on GitHub

PRs

GitHub logo Feature: Dark Mode Toggle and Styling #23

Namatuzio avatar

Namatuzio posted on Dec 08, 2023

@TheShiveshNetwork

Fixes #12

  • Added a dark mode toggle
  • Adjusted theme for when dark mode is enabled
  • Followed guidelines from the official Tailwind CSS Dark Mode guide

I'll post some screenshots of the UI updates but I want to know if you would like anything adjusted in terms of colours, placement, etc, for the implementation before any merge.

Current toggle placement: darkmode toggle button

Homepage colours: Dark mode colours

Pokemon info styling: info styling

I'll mark this as a draft for now and update it until it meets your standards!

View on GitHub

GitHub logo Feature: Custom themes #26

Namatuzio avatar

Namatuzio posted on Dec 11, 2023

@TheShiveshNetwork

Fixes #22

Updates:

  • Added new custom themes: Gameboy & Pokemon Home
  • Gameboy utilizes the limited colour scheme of the original Gameboy and utilizes sprites instead of official art for all 1017 Pokemon
  • Pokemon Home is based on the colours used in the app reference pictures can be found below
  • Made both themes storable
  • Updated the way tracking themes is handled to support any number of additional themes
  • Added a drop-down for the themes
  • Updated SelectComponents.jsx to support ids for tracking the theme changes (default is null).

I had a lot of fun with this, I hope all the changes are up to spec! Here are some pictures of the themes in action:

Gameboy:

gameboy home gameboy info

Pokemon Home:

home home home info

References for the home theme:

home ref home ref 2

taken from the official Nintendo store page

Of course, feel free to request changes, I will add them ASAP!

View on GitHub

EDIT: 12-12-2023 Something seemed to have gone wrong with the merging of the previous PR according to the repo owner, so I made another identical one found here:

GitHub logo Feature: ReAdded Custom themes #28

Namatuzio avatar

Namatuzio posted on Dec 12, 2023

@TheShiveshNetwork

Fixes #22

Created a new PR as requested in #26

Updates:

  • Added new custom themes: Gameboy & Pokemon Home
  • Gameboy utilizes the limited colour scheme of the original Gameboy and utilizes sprites instead of official art for all 1017 Pokemon
  • Pokemon Home is based on the colours used in the app reference pictures can be found below
  • Made both themes storable
  • Updated the way tracking themes is handled to support any number of additional themes
  • Added a drop-down for the themes
  • Updated SelectComponents.jsx to support ids for tracking the theme changes (default is null).

I had a lot of fun with this, I hope all the changes are up to spec! Here are some pictures of the themes in action:

Gameboy:

gameboy home gameboy info

Pokemon Home:

home home home info

References for the home theme:

home ref home ref 2

taken from the official Nintendo store page

Of course, feel free to request changes, I will add them ASAP!

View on GitHub

The final not final TIL

I learned a good amount from the implementation of these features; how to create and style a dark mode (in more ways than one) using both stylesheets and CSS frameworks, creating custom themes using these frameworks, saving styling themes to a local cache and loading it, and lastly, dynamic API calling through referencing IDs. I felt like I poured my heart into these final features, which was reflected in the code review conducted by the repo owner. It was truly a wonderful experience.

Closing thoughts

It's been an incredible 4 months since my open-source journey began and this is not the end of it. I want to deeply thank you all for reading my posts and keeping up! It was a great semester and I'm so happy I got to learn and experiment so much with open-source projects, something that means the absolute most to me. I hope you all enjoy your holiday season and once more, thank you for following the start of my open source journey!

designjavascriptopensourcewebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 1k
  • Popular
  • Answers
  • Author

    How to ensure that all the routes on my Symfony ...

    • 0 Answers
  • Author

    Insights into Forms in Flask

    • 0 Answers
  • Author

    Kick Start Your Next Project With Holo Theme

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.