Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
Guest Cham

Automatic Dark Mode - Avenue Theme

Question

Guest Cham

Hi,

Currently in iOS 13 Beta, dark mode can be enabled automatically. I have seen a lot of blogs add CSS code that’s turns their websites in dark mode when dark mode is initiated on iOS and vice versa. I’ve added a CSS code that turns my site into dark mode on iOS but having trouble with the headings and menu navigation text colour changing to match the theme.

I am currently using the Avenue Theme on chambyte.net. I’ve attached a photo and the CSS code snippet I’m currently using, if anyone can help modify this CSS (or have a better CSS code) for the avenue theme for the blog post title and menu colours too match the theme that would greatly appreciated.


 @media (prefers-color-scheme:     dark) {
 body {
color: #fafafa;
background-color: #1a1a1a; 
}
.blog-title a {
color: #ffffff;
}
 .post-title a {
 color: #ffffff !important;
} 
  blockquote p {
 color: #ffffff !important;
}
}

alt text

Any help will be greatly appreciated.

Many thanks in advance.

7926bb4c-5634-4589-9a19-6654409fe3b1.jpeg.930ec15747a7e2da5de295d449bf7086.jpeg

Edited by Cham
Initial Revision

Share this post


Link to post

16 answers to this question

Recommended Posts

  • 1

@Chambyte


/* Tagline */
.logo-subtitle {
   color: white;
}
/* Nav */
nav.main-nav li a {
   color: white !important;
}
/* Post Title */
article h1.entry-title a {
   color: white !important;
}



You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Squarespace Customer Care

I'm overloading. Will reply all questions this month.

Share this post


Link to post
  • 1

@Chambyte I mean, wrap my code in your code ;)


 @media (prefers-color-scheme:     dark) {
  body {
color: #fafafa;
background-color: #1a1a1a; 
}
.blog-title a {
color: #ffffff;
}
  .post-title a {
  color: #ffffff !important;
} 
   blockquote p {
  color: #ffffff !important;
}
PASTE MY CODE
}



You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Squarespace Customer Care

I'm overloading. Will reply all questions this month.

Share this post


Link to post
  • 1

@Cahmbyte


@media (prefers-color-scheme:dark) {
  h2, h3 {
  color: #fff !important;
}
}

10 minutes: check & find the solution

Edited by tuanphan
Initial Revision

You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Squarespace Customer Care

I'm overloading. Will reply all questions this month.

Share this post


Link to post
  • 1
1 hour ago, MansidakS said:

 

Add to Page Settings > Advanced > Header. Each page has Page Header

<style>
  @media (prefers-color-scheme:     dark) {
  body {
color: #fafafa;
background-color: #1a1a1a; 
}
.blog-title a {
color: #ffffff;
}
  .post-title a {
  color: #ffffff !important;
} 
   blockquote p {
  color: #ffffff !important;
}
PASTE MY CODE
}

</style>

 


You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Squarespace Customer Care

I'm overloading. Will reply all questions this month.

Share this post


Link to post
  • 0
Guest Cham

Hi @tuanphan, thanks for the response.

The CSS code you provided did the job when in Dark Mode but unfortunately it has the opposite effect when light mode is on. As seen in the image below.alt text

021e7e9b-b848-415a-8476-4492dea5ed27.jpeg.60f2b1bb37fa5e472d9669d008ac435f.jpeg

Share this post


Link to post
  • 0
Guest Cham

Hi @tuanphan, thanks for the response.

The CSS code you provided did the job when in Dark Mode but unfortunately it has the opposite effect when light mode is on. As seen in the image below.alt text

021e7e9b-b848-415a-8476-4492dea5ed27.jpeg.8c653cc158586ca6401d76835701abef.jpeg

Share this post


Link to post
  • 0
Guest Cham

You are a true star.

Thank you very much @tuanphan. That worked.

The menu nav on mobile is still grey but that is not much of a big deal. If anything can be done then please help, if not i can just about live with it.

alt text

aa9e6940-6e0e-4502-8709-63d9d5d6ba55.jpeg.e58c483e8488d91e9e84b0f37836298d.jpeg

Edited by Cham
Initial Revision

Share this post


Link to post
  • 0
Guest Cham

Thank you Thank you Thank you @tuanphan, your help is truly appreciated.

Share this post


Link to post
  • 0
Guest Cham

My H2 and H3 Headings in Dark Mode are greyed out. (See Image attached Image). Any help with a CSS Code for H2 and H3 to convert to white text when the blog switches to Dark Mode?

CC: @tuanphan

Many thanks.

alt text

40b886d5-12ec-4b68-af54-c03beac3821f.jpeg.dea82302317fcb25d39d3a8be0a26406.jpeg

Share this post


Link to post
  • 0
Guest Cham

I thank you, @tuanphan. Appreciate your help.

Share this post


Link to post
  • 0
On 7/21/2019 at 10:07 AM, tuanphan said:

@Chambyte I mean, wrap my code in your code 😉



 

 @media (prefers-color-scheme:     dark) {
  body {
color: #fafafa;
background-color: #1a1a1a; 
}
.blog-title a {
color: #ffffff;
}
  .post-title a {
  color: #ffffff !important;
} 
   blockquote p {
  color: #ffffff !important;
}
PASTE MY CODE
}


@tuanphan Is there any way to use this method on just one page? I tried it but it applies to the whole website. Like I just wish one page to go to dark mode. I even tried to wrapping it in the collection ID but then it says that there's a syntax error. Like just make the background dark and the text light because I don't have any other elements on that page. Would appreciate any help!

 

 

Share this post


Link to post
  • 0

@tuanphan Thanks for the quick response. So it does turn the font to white which is great but the background is still white. Am I doing anything wrong? I think the code is not being able to override the site's style property of background color maybe? 

Share this post


Link to post
  • 0
5 minutes ago, MansidakS said:

@tuanphan Thanks for the quick response. So it does turn the font to white which is great but the background is still white. Am I doing anything wrong? I think the code is not being able to override the site's style property of background color maybe? 

Can you share link to your site?


You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Squarespace Customer Care

I'm overloading. Will reply all questions this month.

Share this post


Link to post
  • 0

@tuanphan My bad. Nvm. It worked. Just added .Main and .Header after body. So thank you so much for your help. Means a lot.

 

I wanted to know a couple more things actually:

 

1. Is there a way to invert the color of the logo? I got a black logo as homepage navigation. I usually just use 

header {
 filter: invert(100%);
 }

 in custom css in order to invert the logo color but this time when I use this it inverts the whole header color. Like is there any way to target the logo individually and invert its color?

 

2. And, I understand it might be a long shot, but is there any way to activate the dark theme with a button instead of automatically recognizing it from the browser window? Like a switch button?

Share this post


Link to post
  • 0

Q1. 

.logo-image .logo img {
    filter: invert(1);
}

Q2. You want to add a button, users need to click on it to change to dark mode?

If yes, You need to use JavaScript, complex.

If you want to find free solution, you can also post on some FB groups

  • Squarespace Customization Resource Group
  • Squarespace Community

If you want paid solution, you can message me.


You can send your question to my email to get faster answer.

How to Setup Password & Share URL  Squarespace Customer Care

I'm overloading. Will reply all questions this month.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...