Internal link color in edit mode won't change with CSS script

What I’m trying to do

I’m trying to change the color of internal links in edit and reading mode. Everything is working as expected when the links don’t appear in a dataview table, and when I’m in reading mode. The below is the content of the CSS snippet I’m using:

/* << EDITING link color INTERNAL >> */
.cm-s-obsidian span.cm-hmd-internal-link {
font-weight: 400;
color: green !important;
}

/* << READING link color INTERNAL >> */
.markdown-preview-view .internal-link {
font-weight: 400;
color: green !important;
}

When I’m in reading mode, all is well:

In edit mode, the link in the dataview table doesn’t change color as per the CSS snippet:

Things I have tried

Tried looking in the dataview settings if there was anything there, but couldn’t find anything.

Also tried a bunch of other CSS scripts that simply showed the same issue as above.

Please help! Thanks!

Give this a try. It might need an !important depending on your theme.

body:is(.theme-dark, .theme-light) {
  --link-color: var(--color-green);
}

That seems to only change the color of links that don’t appear in a dataview table (with and without !important).

Humm, seems to be working here.

You could try this one as well, but the above should be fine.

body :is(.block-language-dataview) {
  --link-color: var(--color-green) !important;
}

That’s really odd. I even turned off all my other CSS scripts and left enabled only the ones you suggested (in turn).

The one you suggest in your latest reply seems to do nothing at all for me. Much confusion.

What theme and what version (and installer) of Obsidian are you using?

I’m using Dracula Official, and version 1.1.16 (same as installer).

It’s something about Dracula Official. The snippets above don’t work with Dracula links in dataview tables. :sweat_smile:

Try this one :crossed_fingers:t3:

.internal-link {
  color: var(--color-green);
}
1 Like

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