DEV Community


Discussion on: How to Switch Logo in Dark Mode

sainig profile image
Gaurav Saini • Edited

Another approach would be have an SVG for the logo and just switch the fill color using a css variable. That would eliminate the need for 2 logos, plus an SVG is way smaller in size and much more scalable, so that’s a double win.
Also you can have a smooth transition instead of the current instant switch when using SVG and css

lauragift21 profile image
Gift Egwuenu Author

I agree SVG will better simplify this and will look into implement this approach. Thanks 😊

jalaj profile image

Even better if you just use inline svg. It will save you one request.

pushkar8723 profile image
Pushkar Anand • Edited

Just to add to it. You can use currentColor. This way just switching the body color will switch color in logo as well.

.logo {
    fill: currentColor;