Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dark Mode 🌚 #106

Open
vikaspotluri123 opened this issue Oct 9, 2018 · 12 comments · May be fixed by #615
Open

Add Dark Mode 🌚 #106

vikaspotluri123 opened this issue Oct 9, 2018 · 12 comments · May be fixed by #615
Assignees
Labels
enhancement New feature or request

Comments

@vikaspotluri123
Copy link
Contributor

It's relatively simple to add a toggle between light and dark mode, and javascript can be used to toggle a dark class to the body

Here's an example of one (styles are in sass):

<style>
    .toggle {
        $toggle-width: 50px;
        $toggle-height: $toggle-width / 2 - 2;
        $toggle-border: white;
        $toggle-background: $secondary;
        $toggle-transition: 0.25s;

        position: relative;
        display: inline-flex;
        width: $toggle-width;
        height: $toggle-height;

        .toggle-input {
            display: none;

            &:checked + .toggle-ui:before {
                transform: translateX($toggle-height);
            }
        }

        .toggle-icon {
            position: relative;
            width: 18px;
            height: 18px;
            top: -3px;
        }

        .toggle-ui {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            transition: all $toggle-transition ease-in-out;
            background: $toggle-background;
            border: 2px solid darken($toggle-border, 10%);
            border-radius: 25px;

            &:before {
                position: absolute;
                content: '';
                height: $toggle-height - 10px;
                width: $toggle-height - 10px;
                left: 4px;
                bottom: 2.75px;
                background-color: darken($toggle-border, 10%);
                transition: all $toggle-transition ease-in-out;
                border-radius: 50%;
            }
        }
    }
</style>
<div class="toggle-wrapper">
    <label class="toggle" for="theme">
        <input class="toggle-input" type="checkbox" id="theme">
        <span class="toggle-ui"></span>
		<span class="sr-only">Toggle between light and dark theme</span>
    </label>
</div>
@swapagarwal swapagarwal added the enhancement New feature or request label Oct 10, 2018
@swapagarwal
Copy link
Owner

Yep, I don't see a reason why not? 😏

@vikaspotluri123
Copy link
Contributor Author

I'll work on it after frontend perf (which is scheduled for Friday) if nobody picks it up 👍

@swapagarwal
Copy link
Owner

Cool!

@sseficha
Copy link

sseficha commented Nov 4, 2018

I would like to take on this enhancement as my first contribution. If anyone has already started working on it please let me know! :)

@vikaspotluri123
Copy link
Contributor Author

@sseficha go ahead 😄

@swapagarwal
Copy link
Owner

@sseficha Let us know if you need any help! :)

@sseficha
Copy link

sseficha commented Dec 7, 2018

Yes sorry for the delay, I will post a version within the next few days. :) I have been having some trouble accessing the form at the end of the page so I can toggle a class to give it a dark theme. I cant seem to find the proper selector to use in javascript and toggling a class to the whole body doesn't take the form into account.

@polyzen
Copy link

polyzen commented Dec 7, 2018

@sseficha sseficha mentioned this issue Dec 17, 2018
2 tasks
@tsonge
Copy link
Contributor

tsonge commented May 28, 2020

Hi this issue has been inactive for a while now. Is it okay if I work on it? Thanks.

@vikaspotluri123
Copy link
Contributor Author

@tsonge go for it!

@tsonge tsonge linked a pull request Jun 2, 2020 that will close this issue
7 tasks
@Priyanshudotdev
Copy link

Could you please confirm if this issue has been fixed or closed? I am interested in working on it. Thank you!

@aslafy-z
Copy link
Collaborator

aslafy-z commented Oct 1, 2024

Fell free to take it over, I will assign you. Have a look to the @tsonge PR at #615.

@aslafy-z aslafy-z assigned Priyanshudotdev and unassigned tsonge Oct 1, 2024
@aslafy-z aslafy-z mentioned this issue Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants