Skip to content

Commit

Permalink
add dark mode support
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmaierjr committed Nov 7, 2020
1 parent a9ff7a8 commit 2ae88de
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ _site
.ruby-version
node_modules
.jekyll-cache/
.jekyll-cache/*
.jekyll-cache/*
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ If you really enjoy Long Haul and want to give me credit somewhere on the intern
- Stylish Drop Cap on posts
- A Better Type Scale for all devices
- Comments powered by Disqus
- [Dark Mode support](https://github.com/brianmaierjr/long-haul/blob/gh-pages/preview-dark.png) via [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)

## Setup

Expand Down
4 changes: 2 additions & 2 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ <h1 class="postTitle">{{ page.title }}</h1>
<!-- POST NAVIGATION -->
<div class="postNav clearfix">
{%- if page.previous.url -%}
<a class="prev{%- if page.previous.image -%} image{%- endif -%}" href="{{ page.previous.url | prepend: site.baseurl }}"><span>&laquo;&nbsp;{{ page.previous.title }}</span>
<a class="prev{% if page.previous.image %} image{% endif %}" href="{{ page.previous.url | prepend: site.baseurl }}"><span>&laquo;&nbsp;{{ page.previous.title }}</span>
{%- if page.previous.image -%}
<img src="{{ '/assets/img/' | prepend: site.baseurl | append: page.previous.image }}" alt="">
{%- endif -%}
</a>
{%- endif -%}
{%- if page.next.url -%}
<a class="next{%- if page.next.image -%} image{%- endif -%}" href="{{ page.next.url | prepend: site.baseurl }}"><span>{{ page.next.title }}&nbsp;&raquo;</span>
<a class="next{% if page.next.image %} image{% endif %}" href="{{ page.next.url | prepend: site.baseurl }}"><span>{{ page.next.title }}&nbsp;&raquo;</span>
{%- if page.next.image -%}
<img src="{{ '/assets/img/' | prepend: site.baseurl | append: page.next.image }}" alt="">
{%- endif -%}
Expand Down
2 changes: 1 addition & 1 deletion assets/css/style.css

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions assets/scss/breakpoints/_800up.scss
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,18 @@ CONTACT PAGE STYLING
margin-right: 0;
}
}

/***************
DARK THEME STYLING
***************/

@media (prefers-color-scheme: dark) {
body {
background-color: black;
color: white;
}
.content:after,
.post .featuredImage:before {
background: black;
}
}
27 changes: 27 additions & 0 deletions assets/scss/breakpoints/_mobileup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ FOOTER STYLING

li {
display: inline-block;
margin-right: 8px;

&:last-child {
margin-right: 0;
}

a {
display: inline-block;
Expand Down Expand Up @@ -492,3 +497,25 @@ POST LIST STYLING
}
}


/***************
DARK THEME STYLING
***************/

@media (prefers-color-scheme: dark) {
body {
background-color: black;
color: white;
}

.posts li .date {
color: white;
}
.postNav {
border-top: 1px solid lighten(black, 10%);
border-bottom: 1px solid lighten(black, 10%);
}
.footer .container {
border-top-color: lighten(black, 10%);
}
}
Binary file added preview-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ae88de

Please sign in to comment.