DEV Community

loading...

Discussion on: How to Switch Logo in Dark Mode

Collapse
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

Collapse
lauragift21 profile image
Gift Egwuenu Author

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

Collapse
jalaj profile image
Jalaj

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

Collapse
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;
}