I also found a CSS to color internal links in H1 to H6, but it only works in “Reading Mode”, not in “Live Preview” :
.markdown-rendered h1 > a.internal-link, .cm-header.cm-header-1.cm-hmd-internal-link
{
color: var(--h1Color);
}
/* Same thing for H2 to H6 */
Does anyone know how to also make it work in Live Preview ?
Is the syntax correct or could it be simplified ? It looks quite convoluted to me (.markdown-rendered, .cm-header, .markdown-preview-section : what corresponds to live preview VS reading mode ?) and I’m not sure if it’s still adequate with all the updates Obsidian got. Didn’t find a proper up to date guide explaining that.
@DiCaver : Thank you, I love your idea of seasonal colors and will experiment with your CSS ! How do we quickly change e.g. : from autumn to winter palette ?
Did you have some CSS fundamentals before diving into this ? If no, do you have some recommendations that were of great help to get the gist of it (and with application to Obsidian) ?
On a side note, Kapirklaa on the Discord helped me find the following solution, which seems to do the trick and is much more elegant than what I had before :
body
{
--inline-title-color: var(--h1-color);
--h1-color: #bf616a;
--h2-color: #d08770;
--h3-color: #ebcb8b;
--h4-color: #a3be8c;
--h5-color: #b48ead;
--h6-color: #5e81ac;
}
.HyperMD-header-1, h1 {
--link-color: var(--h1-color);
}
/*Same for h2 to h6*/
I just used DevTool (Ctrl + Shift + I … on Windows), and then, with the inspect tool, I went through elements I was interested in. My first snippet was already “perfect,” but then I realised that reading mode has different classes … this is how I learned (and am still learning).
I’m happy that you found a solution that fits your needs!
I wished to make a plugin out of this for learning purposes, but I am currently working on another plugin. However, you gave me the idea to create separate CSS files, and you turn on the one you want. I will try to do it in the next few days.