Custom css snippet that adapts to light and dark mode

I am using a few custom classes to change the color of text.

Unfortunately, it is difficult to find colors that look good in both light and dark mode. Is there some logic that is available to the css snippet that will allow the color to change based on the mode?

for example the class .greentxt would be

{
color: darkgreen;
}

in a light mode theme, and

{
color: springgreen;
}

in a dark mode theme.

What I’m trying to do

Obsidian uses the classes .theme-light and .theme-dark for mode-specific modifications. This should work:

.theme-light.greentxt {
color: darkgreen;
}

.theme-dark.greentxt {
color: springgreen;
}

This worked. I figured there was a simple way to do it, just couldn’t find it.

Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.