Skip to content

Instantly share code, notes, and snippets.

@xavdid
Created April 23, 2023 06:20
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavdid/fa5d83068a1bd5645641d995d1d008a3 to your computer and use it in GitHub Desktop.
Save xavdid/fa5d83068a1bd5645641d995d1d008a3 to your computer and use it in GitHub Desktop.
Obsidian CSS Customizations
/* set my own variables */
.theme-dark {
/* ==highlights== */
--text-highlight-bg: darkorchid;
/* vertical lines in lists */
--indentation-guide-color: cyan;
/* active sidebar item */
--nav-item-background-active: #e67e00;
/* don't make code smaller than normal text */
--code-size: var(--text-size);
}
/* don't flash when a file is opened / gets focus */
.is-flashing {
transition: none;
background-color: inherit;
}
/* this only affects editing mode, not preview */
.cm-content {
font-family: "Inconsolata", monospace;
}
/* padding around highlights */
.cm-s-obsidian span.cm-highlight,
.markdown-preview-view mark {
padding: 2px;
}
/* inline code */
.markdown-preview-view code {
color: lightgreen;
}
/* border for big headers */
h1,
h2 {
border-bottom: 1px solid white;
font-weight: 600;
}
/* slim down medium headers */
h3,
h4 {
font-weight: lighter;
}
/* carets for H3s */
h3::before {
content: "› ";
}
/* little lines for h4 */
h4 {
text-decoration: dotted underline;
}
/* centered images */
img {
margin: 0 auto;
display: block;
}
/* indentation guides */
.markdown-rendered.show-indentation-guide li>ul::before,
.markdown-rendered.show-indentation-guide li>ol::before {
/* place right in the middle of the bullet in reader mode */
left: -1.04em;
}
.markdown-source-view.mod-cm6 .cm-indent::before {
/* center guide in markdown mode */
/* left: 0.3em; */
}
/* hide indentation guide in code blocks */
.markdown-source-view.mod-cm6 .cm-hmd-codeblock .cm-indent::before {
display: none;
}
/* remove leading padding in code block editing */
.markdown-source-view.mod-cm6 .cm-line.HyperMD-codeblock {
padding-left: 0;
}
/* remove leading padding in code block editing within callouts */
.cm-line.HyperMD-quote .cm-indent::before {
display: none;
}
/* hide "Metadata" header */
.frontmatter-container-header {
display: none !important;
}
/* format metadata box */
.frontmatter-container {
/* nice background box */
background-color: var(--background-secondary-alt);
/* reduce bottom padding */
padding: var(--size-4-2) 0 var(--size-4-2) 5px;
border-radius: 5px;
}
.frontmatter-section {
/* float off the side a bit */
margin-left: 5px;
}
/* remove padding on the last element in a callout, which makes it look more even */
.callout-content> :last-child {
margin-block-end: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment