Change color of a word/text

Dudes, I really would like to have just a simple text color to choose in the Obsidian, as in Notion, for example.

mostra

I’m new at Obsidian and i searched in many topics, but i didn’t find, if there’s any way to do that, please show me, otherwise, this is a essential feature.

7 Likes

You can use HTML tag.
Like this: <font color="red"> YOUR TEXT</font>
Or use hex code for more color: <font color="#cc241d"> YOUR TEXT</font>

5 Likes

I like this tip but it applies on the preview mode only.
Is there any way to have this on edit mode as well?
I guess I should modify a CSS snippet but have no idea :frowning:

You can edit CSS so that your italics and bold will change color instead (But you only have 2 color):

/* Different color for bold*/
.cm-strong,
.markdown-preview-section strong {
  color: #BB29BB !important;
}


/* Different color for italic */
.cm-em {
    color: #cc241d;
	font-style: normal !important;
}

/* of italics in Preview  all notes in a vault */
.markdown-preview-section em {
    color: #cc241d !important;
	font-style: normal !important;
}
8 Likes

Thanks @GreenChocho !!

I’m more than happy with 2 colors :smiley::

/* Different color for bold*/
.cm-strong,
.markdown-preview-section strong {
  color: #86da5f;
  font-style: normal !important; 
  font-weight: normal !important;
}

/* Different color for italic */
.cm-em,
.markdown-preview-section em {
  color: #ad5350;
  font-style: normal !important; 
}
4 Likes

expanding on this, what is the syntax to also change the colour in edit mode?

1 Like

Very much helped out. Thanks!

1 Like

That is the best solution I find to color mark texts so far.
Couldn’t we remap the strikethrough function to another color as well, so that we will have three colors?

I tried to remap it by putting the following.

.cm-s,
.markdown-preview-section s {
  color: green;
  text-decoration:none;
}

But, it is not working to me.

2 Likes

that is very disruptive when editing, suddenly all that code for just a color?

You should be able to. I am using four colors, including strike-through and highlight. Here is the snippet I am using for strike-through:

.cm-strikethrough, del {
  text-decoration: none;
  color: #ff00dd !important;
}

My work around is to use inline latex
eg. $\color{red}Error$
Unfortunately this renders styling like equations which might not be the font style you like, but it works and I am sure some people would be fine with it.

All this note taking power and I can’t easily change the color of the text? Could that be true? It’s hard to believe.

I speak for myself, but I came to Markdown and Obsidian to get away from floating panels and layers of text decoration settings. As you can see in this thread, there are lots of CSS options or plugins there if you want to change the look of things.