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 basic dark theme #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _layouts/episode.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% include ep-head.html %} {% include topbar.html %}

<script src="/assets/javascripts/theme.js"></script>
<img src="//wsrv.nl/?url=ssl:mailta.pe/img/{{ page.guestPic }}&w=2000&t=fit&il&q=90&output=webp&default=ssl:mailta.pe/img/{{ page.guestPic }}" style="display:none;"/>
<div id="bigHeader" class="stretchMe notPlaying" data-stretch="//wsrv.nl/?url=ssl:mailta.pe/img/{{ page.guestPic }}&w=2000&t=fit&il&q=90&output=webp&default=ssl:mailta.pe/img/{{ page.guestPic }}">

Expand Down
18 changes: 18 additions & 0 deletions assets/javascripts/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const loadTheme = () => {
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.body.classList.add('dark')
document.querySelector('#themeSelector').classList.add('dark-mode')
document.querySelector('#themeSelector').classList.remove('light-mode')
} else {
document.body.classList.remove('dark')
document.querySelector('#themeSelector').classList.add('light-mode')
document.querySelector('#themeSelector').classList.remove('dark-mode')
}
}

const toggleTheme = () => {
localStorage.theme = localStorage.theme === 'dark' ? 'light' : 'dark'
loadTheme()
}

loadTheme()
2 changes: 1 addition & 1 deletion assets/stylesheets/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion assets/stylesheets/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
}

}
body.dark #archivePreview {
background: @darkmode;
}

#introStory {

Expand Down Expand Up @@ -135,6 +138,16 @@
.trippy{color: @trippy;}

}
body.dark #introStory {
background: @darkmode;
p {
color: white;
}
}

body.dark #tapePreview {
background: @darkmode;
}

.not-top {
.box-shadow(0px,5px,5px,0px,rgba(0,0,0,.1));
Expand All @@ -148,7 +161,13 @@
color: white;
&.rough{background: @rough;}
&.dreamy{background: @dreamy;}
&.vibrant{background: @vibrant;}
&.vibrant{
background: @vibrant;
color: @darkmode;
}
&.vibrant svg{
fill: @darkmode;
}
&.bliss{background: @bliss;}
&.trippy{background: @trippy;}

Expand Down
2 changes: 1 addition & 1 deletion assets/stylesheets/mailtape.css

Large diffs are not rendered by default.

94 changes: 89 additions & 5 deletions assets/stylesheets/mailtape.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@

html {font-size: 18px;}
#bigHeader {
h1 {font-size: 2.618rem;}
h1 {
font-size: 2.618rem;
-webkit-text-stroke: 2px black;
}
h2 {
-webkit-text-stroke: 0.25px black;
}
}

@media(min-width: 576px){
Expand All @@ -32,6 +38,35 @@ body {
color: @grey;
}

body.dark {
background-color: @darkmode;
color: #fff;

#player {
background-color: @darkmode;
}
#playButtonAsidePlaylist {
filter: invert();
}
.playlist li {
background: @darkmode;
.controls .statusbar, h1 {
background: @darkmode;

}
}
#autoLoop {
filter: invert();
}
#creditAndSupportDesktop {
background: @darkmode;
}
.relatedEpisode img {
border-color: @darkmode;
background: @darkmode;
}
}

.only-mobile{
@media only screen and (min-width: 768px) {
display: none;
Expand Down Expand Up @@ -943,6 +978,7 @@ article {
}

.modal-body {
color: @darkmode;
.button {
float: right;
}
Expand Down Expand Up @@ -1204,6 +1240,7 @@ article {
}

#footerLearnMore {
background-color: #ededed;
color: &lighterGrey;
padding: 0.3em 1em;
font-family: 'superspitze_groteskregular';
Expand All @@ -1212,11 +1249,12 @@ article {
.rounded-corners;
margin: 0.3em 0 2em 0;
.transition;
border: 3px solid #f5f5f5;
background: none;

border: 3px solid #f5f5f5;
&:hover {
background: #f5f5f5;
background: #3a4040;
color: #ededed;
text-decoration: none;
cursor: pointer;
}

}
Expand Down Expand Up @@ -1673,3 +1711,49 @@ a {
display: inline;
}
}


#themeSelector {
display: inline-block;
color: #3a4040;

div {
height: .9rem;
width: .78rem;
}

svg {
width: 0.618rem;
height: 0.618rem;
margin: auto;
transition: all 0s ease-in-out;
overflow: hidden;
}
}
#themeSelector:hover {
color: #ededed;
}
#themeSelector.light-mode:hover svg.themeLight {
height: 0;
width: 0;
}
#themeSelector.dark-mode:hover svg.themeLight {
height: 0.618rem;
width: 0.618rem;
}
#themeSelector.dark-mode svg.themeLight {
height: 0;
width: 0;
}
#themeSelector.dark-mode:hover svg.themeDark {
height: 0;
width: 0;
}
#themeSelector.light-mode:hover svg.themeDark {
height: 0.618rem;
width: 0.618rem;
}
#themeSelector.light-mode svg.themeDark {
height: 0;
width: 0;
}
3 changes: 3 additions & 0 deletions assets/stylesheets/reference.less
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@
//rightsidecolor
@lighterGrey:lighten(@grey,10%);

//Dark mode
@darkmode: #333;

//musicolors
@dreamy:rgba(34, 172, 221, 1.0000); //#22acdd
@rough:rgba(240, 60, 45, 1.0000); //#f03c2d
Expand Down
23 changes: 21 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

</head>

<body>
<body class="">

<div id="scrollUp">
<svg height='2.5rem' width='2.5rem' fill="#FFFFFF" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="-255 347 100 100" style="enable-background:new -255 347 100 100;" xml:space="preserve"><g><path class="st0" d="M-250,430c0,6.6,5.4,12,12,12h66c6.6,0,12-5.4,12-12v-55h-90V430z M-219.4,406.6l13-13c0.8-0.8,2-0.8,2.8,0 l13,13c0.8,0.8,0.8,2,0,2.8c-0.8,0.8-2,0.8-2.8,0l-11.6-11.6l-11.6,11.6c-0.8,0.8-2,0.8-2.8,0 C-220.2,408.6-220.2,407.4-219.4,406.6z"></path><path class="st0" d="M-172,352h-66c-6.6,0-12,5.4-12,12v7h90v-7C-160,357.4-165.4,352-172,352z"></path></g></svg></div>
Expand All @@ -119,6 +119,23 @@
document.write('Contact<\/a>');
// -->
</script>
<a onclick="toggleTheme()" class="" id="themeSelector">
<div>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
class="themeLight"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round"
d="M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
class="themeDark"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round"
d="M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z" />
</svg>
</div>
<script src="/assets/javascripts/theme.js"></script>
</a>
</div>
<div class="pt-3">
<img class="logo" src="{{ site.baseurl }}/img/logo_MailTape_static.png">
Expand Down Expand Up @@ -151,7 +168,7 @@ <h2>A place for music lovers by music lovers</h2>
PS: If you don't want to miss our next release, you may consider <a data-toggle="modal" href="#topLearnMoreModal">following</a> us.
</p>
</div>
<div class="d-none d-lg-flex">
<div id="tapePreview" class="d-none d-lg-flex">
<div>
<img src="" alt=""/>
<!-- <img id="musiColor" src="//wsrv.nl/?url=ssl:www.mailta.pe/img/{{ post.musiColor }}&w=360&il"/> -->
Expand Down Expand Up @@ -243,5 +260,7 @@ <h5 class="modal-title">🌟 Never miss an episode</h5>


{% include footer.html %}
</body>
</html>