Skip to content

Commit

Permalink
Merge pull request #74 from San411/dark_mode
Browse files Browse the repository at this point in the history
A dark mode for the index page
  • Loading branch information
Abdur-rahmaanJ committed Oct 22, 2020
2 parents 53fa557 + bb86454 commit 43de215
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 3 deletions.
59 changes: 58 additions & 1 deletion docs/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,63 @@ section {
text-align: justify;
}

.dark{
background-color: #222;
color: #e6e6e6;
}

.black{
color : white;
background: #222;
}

.label {
position: absolute;
display: inline-flex;
align-items: center;
cursor: pointer;
color: #394a56;
margin-left: 88%;
margin-top: 1%;
}

.label-text {
margin-left: 10px;
margin-right:10px;
font-size: 150%;
}

.toggle {
isolation: isolate;
position: relative;
height: 30px;
width: 60px;
border-radius: 15px;
overflow: hidden;
box-shadow:4px 4px 4px 0px grey;

}

.toggle-state {
display: none;
}

.indicator {
height: 100%;
width: 200%;
background: #ecf0f3;
border-radius: 15px;
transform: translate3d(-75%, 0, 0);
transition: transform 0.4s cubic-bezier(0.85, 0.05, 0.18, 1.35);
box-shadow:
-8px -4px 8px 0px #ffffff,
8px 4px 12px 0px #d1d9e6;
}

.toggle-state:checked ~ .indicator {
transform: translate3d(25%, 0, 0);
}

span.code {
background-color: #DCDCDC;
padding: 2px 6px;
Expand Down Expand Up @@ -78,4 +135,4 @@ footer {
.brand-logo {
margin-left: 20px;
}
}
}
13 changes: 12 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@
<li><a href="https://github.com/Abdur-rahmaanJ/greenBerry">Github</a></li>
<li><a href="http://abdurrahmaanjanhangeer.wordpress.com/">Blog</a></li>
</ul>
<label class="label">
<div >
<span class="label-text " >Dark Mode
</span>
</div>
<div class="toggle" >
<input class="toggle-state change" type="checkbox" name="check" value="check" />
<div class="indicator">
</div>
</div>
</label>
<div class="container">
<section id="header">
<div class="center-align">
Expand Down Expand Up @@ -129,4 +140,4 @@ <h4 class="center-align green-text text-accent-4">That's it to get started!</h4>
<script src="./js/script.js"></script>
</body>

</html>
</html>
15 changes: 14 additions & 1 deletion docs/js/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
// Initialise sidenav trigger
$(document).ready(function () {
$('.sidenav').sidenav();
});
});

$( ".change" ).on("click", function() {
if( $( "body" ).hasClass( "dark" )) {
$( "body" ).removeClass( "dark" );
$( "div" ).addClass( "light" );
$( "span" ).removeClass( "black" );
document.getElementbyClassName("toggle").style.boxShadow = "none";
}
else{
$( "body" ).addClass( "dark" );
$( "span" ).addClass( "black" );
}
});

0 comments on commit 43de215

Please sign in to comment.