0

I'm trying to add a dark mode on my website via prefers-color-scheme webkit. However, my logo is all black, while my header is white. On dark mode it should be the other way around. My logo is in PNG and I thought it wouldn't be a bad idea to somehow upload two logos with different selectors and hide one via CSS on light mode, and the other one on dark mode. My question is: is there any way to do it?

If no, does anyone have any other ideas how could I achieve what I need?

EDIT:

I'm trying to do exactly the same thing as this guy: https://www.youtube.com/watch?v=eY4M7HtP9LA&t

However, his logo is a simple text so he can easily change its color via CSS. Mine is in PNG and I'm not able to do this.

3
  • Hi kacper! This question is off-topic for Wordpress Development as it's about content and css/html/graphics and nothing specific to Wordpress. You may want to find a different StackExchange site to post it. – mozboz Jul 3 '20 at 11:53
  • Sorry, my bad - should I delete the question? I've already received an answer. – kacper3355 Jul 3 '20 at 12:19
  • I'd say leave it, I guess moderators will delete it if they feel like it ;-) – mozboz Jul 3 '20 at 12:20
1
  1. Apply filter: invert(1) in dark mode if your logo is simple enough (in shades of grey).

  2. Overlay your dark mode logo on top of your normal logo and change the opacity.
    This is what we do. Our logo consists of two lines of text, one of them is black and the other is colored. We have the same logo in two containers overlaid one above the other (position: absolute), but one container is half the height of the logo to only cover the first line of text and it has the invert filter applied. When switching to dark mode (with a cool transition), the inverted logo (one white line of text) is revealed.

  3. Use SVG.

1
  • Thank you so much! First idea did the trick. Completely forgot about that possibility! – kacper3355 Jul 3 '20 at 12:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.