Skip to main content

Hello,

I’m having issues getting the background of a dynamic section in my Browse Abandonment email to show as white (for proper branding in dark mode). I’ve tried setting the background to white, I’ve set the block background to white. I’m just at a loss!

Hi there,

That’s strange! Have you reviewed the settings in the Styles tab?

 

If so, how about the block’s background?
(You’ve probably gone about over it, but I’m just making sure you’ve seen that)

 

 

Let me know if you’ve found the solution.


Best,
Stam​​​​​​​


Hi @stam_marko ,

Yup, I’ve tried it all!! It’s only on Gmail’s mobile app, in darkmode. 

DARK MODE

 

THIS IS HOW IT SHOULD LOOK

 


I see!

What I do to avoid overcomplicating the emails I create, is to have the Hero Title and the CTA as text blocks, or PNGs. That way, the dark mode is not only in the dynamic block but in the whole Section 1.

Give it a go! The lovely blue that you have in the header and Section 2, might complement well the Gmail’s default dark mode appearance.

Now, if you really need it to be white in dark mode, how about trying to force it through HTML?

I haven’t done this specific edit myself, so I’m not familiar with this process, but you could try it and let the community know. Here are the steps:

  1. Save the email as a template.
  2. Go to Templates and then the three dots, Export Email
  3. In your provided HTML code, you should add the following CSS within the <style> tags:

<style>     /* Existing styles... */

    /* Force white background in dark mode */     @media (prefers-color-scheme: dark) {         .force-white-background-in-dark-mode {             background-color: white !important;         }     } </style>

  1. Find the piece of code right in the dynamic block
  1. Next, you need to apply the force-white-background-in-dark-mode class to the HTML element of the dynamic checkout product block. Based on the Klaviyo’s checkout code, it seems like the relevant section is where the product items are listed (inside the {% for item in event.extra.Items %} loop). You should add the class to the <td> or <div> elements that you want to have a white background in dark mode.

 <!-- Inside your for loop for items --> <tr>     <td class="kl-table-subblock force-white-background-in-dark-mode" style="...">         <!-- Content here -->     </td>     <!-- Other table data --> </tr>

 

*It's important to note that not all email clients support CSS media queries, and their support for dark mode varies. Therefore, while the following solution can work for some email clients, it might not be universally effective.

 

 

I understand that this approach might be too complicated, but this is the only thing that comes to my mind if you need the block’s background to remain white.


I will give this a shot, thank you so much!!


Reply