Obsidian Magic

Here's a technical tip on how to create your own custom obsidian callouts using the css snippet file. I used this to create an idea callout in Obsidian.

Obsidian Magic

I have been sharing with people for a while how I use Obsidian to set up my Personal Knowledge Management System.  Along the way, I keep chipping away at some minor technical improvements, what developers call "quality of life" improvements. I have created a set of videos I have shared on YouTube to try and walk you through setting up a vault and doing some simple things. However, there are times when I just want to share some cool thing I figured out on my own.

Callouts

One of my favorite features of Obsidian are callouts.  These boxes are blocks of colored text that you can drop into a note to draw the reader's attention - sort of like an inline footnote.  Below is an example of a callout:

📋
This is an example of a callout
You can use a call out like an inline footnote.

Callouts let you capture a tangent thought or observation in a note.

‌Built in Callouts

So how do you use them in Obsidian? Because everything in Obsidian is Markdown, so too are the callouts.  Granted, they are custom form of markdown, but it works.  

> [!note] This is a note style callout header
> This is the body of the calloutmarkdow

This bit of code will produce a call out like the one shown above, but below is a screen shot of one in my vault theme format.‌‌

Now there are a total of 13 built in call out styles that all use the same basic structure, use a > block quote coupled with [!coalloutcode]  square brackets, an exclamation point and the callout code you want to use.  There's more great documentation in the Obsidian online help.

Making a custom callout.

Despite all the nifty codes, I found that there was on callout I wanted. I wanted one for ideas, like a lightbulb.  And leads me to the reason for this post.

You can put a custom css file in your vault/.obsidian/snippets folder - mine is called obsidian.css.  You need to do this on a PC or laptop because since iOS 16 you can no longer access hidden folders on an iPhone or iPad.

This file is referenced by your Appearences setting in Obsidian.  The code to put in a new callout looks like this:

.callout[data-callout="idea"] {
  --callout-icon: lucide-lightbulb;
  --callout-color: 218, 165, 32;
}

The key to this is the the background color must be the decimal integer red, green, and blue color codes.  You can't use a hex code or a name.  The icon is selected from Lucide.dev and you prepend the icon name with lucide-.  For example, I wanted the lightbulb, but to access it I had to call it lucide-lightbulb.

Now, to access an "idea" callout all I have to do is:

> [!idea] I have a great idea
> I want an idea call out!

Using that markdown creates the following rendering in my Obsidian.

How I use this

When I am working with book quotes, or capturing notes, sometimes reviewing and organizing notes sparks ideas - and I want to call those out, so I don't forget them and keep them close to the content that inspired the thought, but I don't want them to get lost in the train of text.

Built in callout codes

There are 13 callout codes and a few synonyms. (you can use hint in place of tip to get the same type of call out).  Each has its own icon, and background color.

  • Note
  • Abstract (summary, tldr)
  • Tip (hint,important)
  • Info
  • Todo
  • Success (check,done)
  • Question (help,faq)
  • Warning (caution,attention)
  • Failure (fail, missing)
  • Danger (error)
  • Bug
  • Example
  • Quote (cite)

I hope you find this helpful.