Skip to content

Dark Mode CSS #64

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

Merged
merged 2 commits into from
Mar 11, 2021
Merged
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 docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ module.exports = {
colorMode: {
// Hides the switch in the navbar
// Useful if you want to support a single color mode
disableSwitch: true,
disableSwitch: false,
},
announcementBar: {
id: 'redisconf20201cfp', // Any value that will identify this message.
Expand Down
94 changes: 93 additions & 1 deletion src/css/_article.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@

--ifm-tabs-color: var(--black);
--ifm-tabs-color-active: var(--purple);

--ifm-code-color: var(--black);
}

html[data-theme="dark"] {
--ifm-menu-color: var(--white);
--ifm-menu-color-active: #829EF0;
--ifm-menu-color-background-active: #181D27;
--ifm-menu-color-background-hover: #181D27;
--ifm-toc-border-color: #676768;
--ifm-toc-link-color: var(--white);
--ifm-code-color: var(--white);
}

hr {
Expand Down Expand Up @@ -73,6 +85,7 @@ hr {

li {
margin-right: 0;
line-height: 1.5;
}

&__link {
Expand All @@ -85,6 +98,10 @@ hr {
font-weight: 700;
color: $purple;

@include dark {
color: #829EF0;
}

&:before {
position: absolute;
top: 0;
Expand All @@ -93,6 +110,24 @@ hr {
height: 100%;
background-color: $purple;
content: '';

@include dark {
background-color: #829EF0;
}
}
}

&:hover {
@include dark {
color: #829EF0;
}
}

code {
color: $black !important;

@include dark {
color: $white !important;
}
}
}
Expand All @@ -108,6 +143,11 @@ hr {

blockquote {
border-left: 5px solid #dbdada;

@include dark {
border-color: #676768;
color: $white;
}
}

main:not(.home-main) {
Expand All @@ -117,6 +157,10 @@ main:not(.home-main) {

&:hover {
color: $purple-hover;

@include dark {
color: #829EF0;
}
}
}

Expand All @@ -130,6 +174,10 @@ main:not(.home-main) {
@include mobile {
font-size: 39px;
}

@include dark {
color: $white;
}
}
}
}
Expand All @@ -138,6 +186,10 @@ main:not(.home-main) {
.markdown {
color: $black;

@include dark {
color: $white;
}

h1,
h2,
h3,
Expand Down Expand Up @@ -257,6 +309,10 @@ main:not(.home-main) {
.tabs {
border-bottom: 1px solid $grey-light;

@include dark {
border-color: #676768;
}

&__item {
margin-top: 0 !important;
padding: 0 10px 10px;
Expand All @@ -265,13 +321,21 @@ main:not(.home-main) {
font-size: 17px;
transition: color .2s ease-in-out;

@include dark {
color: $white;
}

&:not(:last-child) {
margin-right: 10px;
}

&:hover {
background-color: transparent;
color: $purple-hover;
color: $purple-hover !important;

@include dark {
color: #829EF0 !important;
}
}

&--active {
Expand All @@ -289,8 +353,20 @@ main:not(.home-main) {
box-shadow: 0px 4px 7px rgba(196, 196, 196, .5);
transition: border-color .2s ease-in-out;

@include dark {
background-color: #2a2c2d;
border-color: #2a2c2d;
box-shadow: none;
color: $white;
}

&.ri-link:hover {
border-color: $purple;

@include dark {
border-color: $purple-hover;
background-color: #2a2b2d;
}
}

.ri-card-link {
Expand Down Expand Up @@ -320,6 +396,14 @@ main:not(.home-main) {

a {
color: $black;

@include dark {
color: $white;

&:hover {
color: #829EF0;
}
}
}
}

Expand All @@ -328,6 +412,10 @@ main:not(.home-main) {
font-size: 16px;
color: $black;

@include dark {
color: $white;
}

img {
margin-top: 15px;
}
Expand All @@ -341,6 +429,10 @@ main:not(.home-main) {
code {
border-radius: 4px;
background-color: $purple-light;

@include dark {
background-color: #3E44AC;
}
}

iframe {
Expand Down
8 changes: 8 additions & 0 deletions src/css/_config.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ monospace;
--purple-lighter: #F9FAFF;
}

/* dark mode */

@mixin dark {
html[data-theme="dark"] & {
@content;
}
}

/* media queries */
@mixin desktop {
@media only screen and (min-width: 997px) {
Expand Down
10 changes: 10 additions & 0 deletions src/css/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ h6 {

// section-title
.section-title {
z-index: 2;
position: relative;
margin: 0;
text-align: center;
line-height: 1.15;
Expand All @@ -19,6 +21,10 @@ h6 {
font-size: 32px;
}

@include dark {
color: $white;
}

&.white {
color: $white;
}
Expand All @@ -44,6 +50,10 @@ h6 {
font-size: 16px;
}

@include dark {
color: $white;
}

&:not(:first-child) {
margin-top: 11px;

Expand Down
19 changes: 17 additions & 2 deletions src/css/components/_demos.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@
position: absolute;
top: -37px;
left: -109px;
height: 477.5px;
user-select: none;

@include dark {
opacity: .4;
}
}

.col {
Expand Down Expand Up @@ -88,6 +91,10 @@
min-height: 220px;
}

@include dark {
background-color: $primary-black;
}

.title {
margin: 0;
line-height: 1;
Expand All @@ -96,6 +103,10 @@
@include mobile {
font-size: 22px;
}

@include dark {
color: $white;
}
}

.links {
Expand Down Expand Up @@ -127,8 +138,12 @@
color: $primary-blue;
transition: color .2s ease-in-out;

@include dark {
color: $white;
}

&:hover {
color: $purple;
color: $purple !important;
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/css/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
--ifm-global-radius: 10px;
}

html[data-theme="dark"] {
--ifm-background-color: var(--primary-black);
}

.container {
max-width: 1140px;
}
Expand Down
Binary file modified static/img/code-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.