What I’m trying to do
I am trying to assign different colors to links (both resolved, i.e. where the linked note has been created, and unresolved, i.e. that are still waiting for the linked note to be created). Specifically, I want to have links to “Literature” notes in light blue, links to “Primary Sources” and “Cases” notes in pink, links to “Concepts” in orange, and links to “Ideas” in red.
In practice, I would like to:
first, assign a category to the link I’m creating (literature, primary source, etc.)
second, color-code the link for that category
The result ideally should be the following:
I type in [[lit_Smith 2011]]
and what appears is just Smith 2011 in light blue
Things I have tried
ChatGPT came up with a code for this, but it doesn’t work. Here is the code:
/* Style Literature links */
a.internal-link[href^=“lit_”], a.is-unresolved[href^=“lit_”] {
color: lightblue !important;
}
/* Style Primary sources links */
a.internal-link[href^=“ps_”], a.is-unresolved[href^=“ps_”] {
color: pink !important;
}
/* Style Cases links */
a.internal-link[href^=“case_”], a.is-unresolved[href^=“case_”] {
color: pink !important;
}
/* Style Concepts links */
a.internal-link[href^=“con_”], a.is-unresolved[href^=“con_”] {
color: orange !important;
}
/* Style Ideas links */
a.internal-link[href^=“idea_”], a.is-unresolved[href^=“idea_”] {
color: red !important;
}
I created the .css file, activated it in snippets, but Obsidian doesn’t apply it. It does, however, read the .css file because if I type in a simple code to turn all links to green, it applies it and it works. I’m thinking GPT’s code is the problem. We have actually tried many different ones (e.g. adding “important” here and there in the code etc.), but nothing works. Spent a whole day on this.
Could someone please help me with a code that works?? Thank you!