Skip to content

Instantly share code, notes, and snippets.

@rcanand
Created January 6, 2026 22:25
Show Gist options
  • Select an option

  • Save rcanand/07a1cb9694475bbf267647e59f8f3488 to your computer and use it in GitHub Desktop.

Select an option

Save rcanand/07a1cb9694475bbf267647e59f8f3488 to your computer and use it in GitHub Desktop.
/* A Dark Mode Markdown Preview stylesheet for vscode markdown previews
Created via Claude chat
- Download and add this file in each vscode workspace root that you want to use it.
- In your workspace settings, ./.vscode/settings.json, add a reference to this.
{
"markdown.styles": [
"md_preview_dark_theme.css"
]
}
- Now, whenever you open a markdown file as a preview (Markdown: Open Preview to the side), you will get colors for all the markup - headings,
*/
:root {
--bg-primary: #1e1e1e;
--bg-secondary: #2d2d2d;
--bg-code: #252525;
--text-primary: #e4e4e4;
--text-secondary: #b0b0b0;
--border-color: #404040;
--heading-1: #ff79c6;
--heading-2: #bd93f9;
--heading-3: #8be9fd;
--heading-4: #50fa7b;
--heading-5: #ffb86c;
--heading-6: #f1fa8c;
--link-color: #8be9fd;
--link-hover: #50fa7b;
--code-color: #50fa7b;
--blockquote-border: #bd93f9;
--blockquote-bg: #2a2a3e;
--table-border: #404040;
--table-header-bg: #2d2d3d;
}
/* Base Styles */
body {
background-color: var(--bg-primary);
color: var(--text-primary);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", sans-serif;
font-size: 16px;
line-height: 1.6;
padding: 2rem;
max-width: 900px;
margin: 0 auto;
}
/* Headings */
h1 {
color: var(--heading-1);
border-bottom: 3px solid var(--heading-1);
padding-bottom: 0.5rem;
margin-top: 2rem;
margin-bottom: 1rem;
font-weight: 700;
font-size: 2.5em;
}
h2 {
color: var(--heading-2);
border-bottom: 2px solid var(--heading-2);
padding-bottom: 0.4rem;
margin-top: 1.8rem;
margin-bottom: 0.9rem;
font-weight: 600;
font-size: 2em;
}
h3 {
color: var(--heading-3);
margin-top: 1.6rem;
margin-bottom: 0.8rem;
font-weight: 600;
font-size: 1.5em;
}
h4 {
color: var(--heading-4);
margin-top: 1.4rem;
margin-bottom: 0.7rem;
font-weight: 600;
font-size: 1.25em;
}
h5 {
color: var(--heading-5);
margin-top: 1.2rem;
margin-bottom: 0.6rem;
font-weight: 600;
font-size: 1.1em;
}
h6 {
color: var(--heading-6);
margin-top: 1rem;
margin-bottom: 0.5rem;
font-weight: 600;
font-size: 1em;
}
/* Paragraphs */
p {
margin-bottom: 1rem;
color: var(--text-primary);
}
/* Links */
a {
color: var(--link-color);
text-decoration: none;
border-bottom: 1px solid transparent;
transition: all 0.2s ease;
}
a:hover {
color: var(--link-hover);
border-bottom: 1px solid var(--link-hover);
}
a:visited {
color: #bd93f9;
}
/* Code */
code {
background-color: var(--bg-code);
color: var(--code-color);
padding: 0.2rem 0.4rem;
border-radius: 3px;
font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas,
monospace;
font-size: 0.9em;
border: 1px solid var(--border-color);
}
pre {
background-color: var(--bg-code);
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 1rem;
overflow-x: auto;
margin: 1rem 0;
}
pre code {
background-color: transparent;
border: none;
padding: 0;
color: var(--text-primary);
font-size: 0.95em;
}
/* Blockquotes */
blockquote {
border-left: 4px solid var(--blockquote-border);
background-color: var(--blockquote-bg);
margin: 1.5rem 0;
padding: 1rem 1.5rem;
color: var(--text-secondary);
border-radius: 0 4px 4px 0;
font-style: italic;
}
blockquote p:last-child {
margin-bottom: 0;
}
/* Lists */
ul,
ol {
margin: 1rem 0;
padding-left: 2rem;
}
li {
margin-bottom: 0.5rem;
color: var(--text-primary);
}
li::marker {
color: var(--heading-3);
font-weight: bold;
}
ul ul,
ol ol,
ul ol,
ol ul {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
/* Task Lists */
input[type="checkbox"] {
margin-right: 0.5rem;
accent-color: var(--code-color);
}
/* Tables */
table {
border-collapse: collapse;
width: 100%;
margin: 1.5rem 0;
background-color: var(--bg-secondary);
border-radius: 6px;
overflow: hidden;
}
thead {
background-color: var(--table-header-bg);
}
th {
color: var(--heading-3);
font-weight: 600;
text-align: left;
padding: 0.75rem 1rem;
border-bottom: 2px solid var(--border-color);
}
td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--table-border);
color: var(--text-primary);
}
tr:last-child td {
border-bottom: none;
}
tr:hover {
background-color: rgba(139, 233, 253, 0.1);
}
/* Horizontal Rules */
hr {
border: none;
height: 2px;
background: linear-gradient(
to right,
var(--heading-1),
var(--heading-2),
var(--heading-3)
);
margin: 2rem 0;
border-radius: 2px;
}
/* Text Formatting */
strong,
b {
color: var(--heading-5);
font-weight: 700;
}
em,
i {
color: var(--heading-6);
font-style: italic;
}
del,
s {
color: var(--text-secondary);
text-decoration: line-through;
opacity: 0.7;
}
/* Images */
img {
max-width: 100%;
height: auto;
border-radius: 6px;
margin: 1rem 0;
border: 1px solid var(--border-color);
}
/* Inline Elements */
mark {
background-color: rgba(241, 250, 140, 0.3);
color: var(--text-primary);
padding: 0.1rem 0.2rem;
border-radius: 2px;
}
kbd {
background-color: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 3px;
box-shadow: 0 2px 0 var(--border-color);
color: var(--text-primary);
display: inline-block;
font-family: "SF Mono", Monaco, monospace;
font-size: 0.85em;
padding: 0.2rem 0.4rem;
margin: 0 0.1rem;
}
/* Definition Lists */
dl {
margin: 1rem 0;
}
dt {
color: var(--heading-4);
font-weight: 600;
margin-top: 1rem;
}
dd {
margin-left: 2rem;
margin-bottom: 0.5rem;
color: var(--text-secondary);
}
/* Scrollbar Styling */
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
background: #505050;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment