Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created December 14, 2023 20:19
Show Gist options
  • Save davidgilbertson/b2299fdce5028ed44428efbce01f673e to your computer and use it in GitHub Desktop.
Save davidgilbertson/b2299fdce5028ed44428efbce01f673e to your computer and use it in GitHub Desktop.
/* Obsidian CSS reference: https://docs.obsidian.md/Reference/CSS+variables/Editor/Code */
body {
/* Code syntax highlighting */
--jetbrains-grey-code: #BCBEC4;
--code-normal: --jetbrains-grey-code;
--code-comment: #7A7E85;
--code-function: --jetbrains-grey-code;
--code-important: hotpink;
--code-keyword: #CF8E6D;
--code-operator: --jetbrains-grey-code;
--code-property: --jetbrains-grey-code;
--code-punctuation: #D5B778;
--code-string: #6AAB73;
--code-tag: #D5B778;
--code-value: #2AACB8;
--code-background: #16161a;
--background-primary: #1E1F22;
--background-secondary: #2B2D30;
--file-margins: 16px; /* Padding around a note */
/* Search results, highlights, etc */
--text-highlight-bg: teal;
--list-indent: 50px;
}
.view-content {
/* Other colors '1f77b4', 'ff7f0e', '2ca02c', 'd62728', '9467bd' */
--h1-color: #4e7fb4;
--h2-color: #c47737;
--h3-color: #5cb05c;
--h4-color: #cc4e6c;
--h1-weight: 400;
--h2-weight: 400;
--h3-weight: 400;
--h4-weight: 400;
/* Search results, highlights, etc */
--text-highlight-bg: #004a4a;
}
/* Separate the page header from the body */
.is-focused .workspace-leaf.mod-active .view-header {
border-bottom: 1px solid var(--background-secondary);
}
.cm-inline-code, code {
--code-normal: #CF8E6D;
}
/* So that inline code doesn't move when the backticks show up */
.cm-formatting.cm-formatting-code.cm-inline-code {
margin-left: -1px;
margin-right: -1px;
}
.markdown-source-view.mod-cm6 .cm-widgetBuffer + .cm-inline-code:not(.cm-formatting) {
padding-left: calc(1ch - 2px);
padding-right: calc(1ch - 2px);
}
/* Remove [Square bracket text] style */
.cm-s-obsidian span.cm-link, .cm-s-obsidian span.cm-link:hover {
color: var(--text-normal);
text-decoration: none;
}
/* Heading stuff */
/* If the bottom margin is too big you hit a bug: https://forum.obsidian.md/t/home-key-on-checkbox-list-item-goes-to-next-line-when-after-an-h2-or-h3-title/55653/14 */
.markdown-reading-view h1, .markdown-source-view.mod-cm6 .HyperMD-header-1 {
margin-bottom: 0.1em !important;
}
.markdown-reading-view h2, .markdown-source-view.mod-cm6 .HyperMD-header-2 {
margin-bottom: 0.1em !important;
}
.markdown-reading-view h3, .markdown-source-view.mod-cm6 .HyperMD-header-3 {
margin-bottom: 0.1em !important;
}
.markdown-reading-view h4, .markdown-source-view.mod-cm6 .HyperMD-header-4 {
margin-bottom: 0.1em !important;
}
/* Paragraph spacing */
/* This targets only lines that aren't anything special */
div[class="cm-line"], div[class="cm-active cm-line"] {
padding-top: 0.3em !important;
padding-bottom: 0.3em !important;
}
/* The below two break cursor movement with the arrow keys */
/*.markdown-source-view.mod-cm6 .cm-content > .HyperMD-codeblock-begin {*/
/* margin-top: 0.3em !important;*/
/*}*/
/*.markdown-source-view.mod-cm6 .cm-content > .HyperMD-codeblock-end {*/
/* margin-bottom: 0.3em !important;*/
/*}*/
.markdown-reading-view p br {
content: "\00a0";
padding-bottom: 0.5em !important;
display: block;
}
/* -- Better list icons -- */
.list-bullet {
padding-right: 1ch;
}
/* Level 1 */
.markdown-reading-view ul > li > .list-bullet:after,
.markdown-source-view.mod-cm6 .HyperMD-list-line-1 .list-bullet:after {
/* Bullet */
height: 5.5px;
width: 5.5px;
border-radius: 50%;
background-color: var(--text-normal);
}
/* Level 2 */
.markdown-reading-view ul > li > ul > li > .list-bullet:after,
.markdown-source-view.mod-cm6 .HyperMD-list-line-2 .list-bullet:after {
height: 5px;
width: 5px;
background-color: transparent;
border-color: var(--text-normal);
border-style: solid;
border-radius: 50%;
border-width: 1px;
}
/* Level 3 */
.markdown-reading-view ul > li > ul > li > ul > li > .list-bullet:after,
.markdown-source-view.mod-cm6 .HyperMD-list-line-3 .list-bullet:after {
height: 5px;
width: 5px;
border-radius: 0;
background-color: var(--text-normal);
}
/* Level 4 */
.markdown-reading-view ul > li > ul > li > ul > li > ul > li > .list-bullet:after,
.markdown-source-view.mod-cm6 .HyperMD-list-line-4 .list-bullet:after {
height: 5px;
width: 5px;
background-color: Transparent;
border-color: var(--text-normal);
border-style: solid;
border-radius: 0;
border-width: 1px;
}
/* List indents, because I'm not using tabs */
.HyperMD-list-line-1 { padding-left: 22px !important; }
.HyperMD-list-line-2 { padding-left: 44px !important; }
.HyperMD-list-line-3 { padding-left: 66px !important; }
.HyperMD-list-line-4 { padding-left: 88px !important; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment