Common Selectors for Custom CSS

Left Ribbon

  • Collapsed
  • Open

Selectors:

  • .side-dock-ribbon { ...} --> Selects both ribbons
  • .workspace-ribbon.mod-left { ... } --> Selects just the left ribbon when open
  • .workspace-ribbon.mod-left.is-collapsed { … } --> Selects just the left ribbon when closed

Common CSS:

  • background-color: red;
  • width: 50px;

Images:

4 Likes

@lizardmenfromspace Great job!! This will be super helpful.

There is a previous css guide from @Reggie, which can be put together here, although it is based on old version:

Graph View

/*background of graph view pane*/
.workspace-leaf-content[data-type = "graph"] .view-content{
  background-color: var(--background-primary);
}

/*filled color for the circle when not hover*/
.graph-view.color-fill {
  color: var(--background-secondary);
}

/*color for the circle stroke */
.graph-view.color-circle {
  color: var(--text-normal);
}

/*color for the connecting line when not hover*/
.graph-view.color-line {
  color: var(--background-modifier-border);
}

/*color for texts*/
.graph-view.color-text {
  color: var(--text-normal);
}

/*filled color for the circle when hover*/
.graph-view.color-fill-highlight {
  color: var(--interactive-accent);
}

/*color for the connecting line when hover*/
.graph-view.color-line-highlight {
  color: rgb(var(--interactive-accent-rgb));
}
4 Likes

A little more descriptions for those unfamiliar with CSS, please?

2 Likes

Didn’t quite understand what this is supposed to mean :confused:

1 Like

Comment added.

1 Like

Collapse / Open Icon

Selectors

  • .workspace-ribbon-collapse-btn { ... }
  • .workspace-ribbon.is-collapsed .workspace-ribbon-collapse-btn { ... }
  • .workspace-ribbon-collapse-btn:hover { ... }

Common CSS:

  • margin-top: 20px;
  • padding: 20px 6px;
  • cursor: pointer;
  • color: var(--text-faint);
  • transform: none;
  • transition: transform 200ms ease-in-out;

Plugin Icons

Selectors

  • .side-dock-actions { ... }
  • .side-dock-ribbon-action { .. }
    • HTML Atrributes
      • aria-label="Open quick switcher"
      • aria-label="Open graph view"
      • aria-label="Open today's note"
      • aria-label="Create new Zettelkasten note"
      • aria-label="Open random note"

Common CSS

  • color: var(--text-faint);
  • text-align: center;
  • cursor: pointer;
  • stroke-width: 2px;

Bottom Icons

Selectors

  • .side-dock-settings { ... }
  • .workspace-ribbon.mod-left.is-collapsed .side-dock-ribbon-action { ... }
  • .side-dock-ribbon-action { ... }
    • HTML Atrributes
      • aria-label="Open another vault"
      • aria-label="Help"
      • aria-label="Settings"

Common CSS

  • color: var(--text-faint);
  • text-align: center;
  • cursor: pointer;
  • stroke-width: 2px;

Hi, newbie to CSS here. I’m trying to change the color of the file extension in File Explorer. The dev window tells me it’s .nag-file-tag { } but I don’t see that in the obsidian.css file and can’t file it on the lists here either. Any idea how to edit it?

Hi, looking for selectors for the popover previews. Trying to eliminate the scroll bars on embeds showing in the popover preview, but can’t find the right selectors. Any info?

1 Like

hi. can anyone help me on why all my light themes are actually kind of yellowish but not true white? been fiddling with the css file and reading these posts but I’m getting nowhere… sorry if this isn’t the right place for this question, my first time on the forum.

Hey, rvc…did you resolve your issue?

Hi @lizardmenfromspace is there any way to add a background in the modal-bg?
I wanted to put a picture or some interesting animation when I open the settings menu. Just to relax.

How would you go about overriding the color of headers and links in reading views? Is the printing css the same as the reader ?

@tobei: try this:

/* Change header color */
.markdown-preview-view h1 {
  color: var(--text-accent); /* change to your preferred color */
}

As for links: external or internal?

1 Like

Seems like a couple more tags appeared. For instance:

.theme-dark .graph-view.color-fill-tag {
color: #ff0000;
}

To change color of the ‘tag’ nodes on the graph. By the way, is there maybe separated css tag for labels of ‘tag’ nodes? I’ve changed color of the nodes with code posted above but would like to change labels color as well, bus cannot find any mentions of such option.

2 Likes

Is there any way to load custom CSS libraries (e.g. Augmented-UI <link rel="stylesheet" type="text/css" href="https://unpkg.com/augmented-ui@2/augmented-ui.min.css">) into themes?

For augmented UI, you usually have to load the stylesheet AND add “data-augmented-ui” value to the

in the HTML code, so you can address it in CSS.

Anyone got any idea how to achieve this?

Hey everyone,

wondered how to change the background color of the notes, in all view modes (edit source/live preview and read)?

I use the Encore theme and would love to use the RGB theme of it but change its black background color (in dark mode) of notes into the dark grey one of its Obsidian Redux theme.

I guess changing the color in the theme’s css would only last until the next update of it, right? So I thought using a CSS Snippet would be better.

How can I achieve that?

An easy way to do this would be to change the variable --background-primary in dark mode, since the body of the note uses this color.

.theme-dark {
--background-primary: /* YOUR custom color! */ !important;
}

The !important may not be needed, but I included it just in case.