Commit b1a7b9b9 authored by Himanshu Kapoor's avatar Himanshu Kapoor

Fix markdown preview styling for dark theme

Fixes in markdown preview styling for Web IDE dark theme
parent bc55b37b
...@@ -24,13 +24,24 @@ let mermaidModule = {}; ...@@ -24,13 +24,24 @@ let mermaidModule = {};
function importMermaidModule() { function importMermaidModule() {
return import(/* webpackChunkName: 'mermaid' */ 'mermaid') return import(/* webpackChunkName: 'mermaid' */ 'mermaid')
.then(mermaid => { .then(mermaid => {
let theme = 'neutral';
if (
window.gon?.user_color_scheme === 'dark' &&
window.gon?.features?.webideDarkTheme &&
// if on the Web IDE page
document.querySelector('.ide')
) {
theme = 'dark';
}
mermaid.initialize({ mermaid.initialize({
// mermaid core options // mermaid core options
mermaid: { mermaid: {
startOnLoad: false, startOnLoad: false,
}, },
// mermaidAPI options // mermaidAPI options
theme: 'neutral', theme,
flowchart: { flowchart: {
useMaxWidth: true, useMaxWidth: true,
htmlLabels: false, htmlLabels: false,
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
$btn-disabled-border: rgba(223, 223, 223, 0.24); $btn-disabled-border: rgba(223, 223, 223, 0.24);
$btn-disabled-color: rgba(145, 145, 145, 0.48); $btn-disabled-color: rgba(145, 145, 145, 0.48);
$diff-insert: rgba(155, 185, 85, 0.2);
$diff-remove: rgba(255, 0, 0, 0.2);
a { a {
color: $link-color; color: $link-color;
} }
...@@ -37,6 +40,8 @@ ...@@ -37,6 +40,8 @@
h4:not(.modal-title), h4:not(.modal-title),
h5, h5,
h6, h6,
code,
.md table:not(.code),
.md, .md,
.md p, .md p,
.ide-view, .ide-view,
...@@ -86,6 +91,7 @@ ...@@ -86,6 +91,7 @@
background-color: transparent; background-color: transparent;
} }
code,
.multi-file-commit-panel, .multi-file-commit-panel,
.multi-file-tabs, .multi-file-tabs,
.multi-file-tabs li, .multi-file-tabs li,
...@@ -102,6 +108,10 @@ ...@@ -102,6 +108,10 @@
background-color: $background; background-color: $background;
} }
pre code {
background-color: inherit;
}
.ide-sidebar-link:hover { .ide-sidebar-link:hover {
background-color: $background-hover; background-color: $background-hover;
} }
...@@ -111,6 +121,7 @@ ...@@ -111,6 +121,7 @@
} }
&, &,
.md table:not(.code) tr th,
.multi-file-commit-panel-inner-content, .multi-file-commit-panel-inner-content,
.multi-file-commit-form, .multi-file-commit-form,
.multi-file-tabs li.active, .multi-file-tabs li.active,
...@@ -141,6 +152,12 @@ ...@@ -141,6 +152,12 @@
border-color: $border-color; border-color: $border-color;
} }
.md h1,
.md h2,
.md blockquote,
pre,
.md table:not(.code) tbody td,
.md table:not(.code) tr th,
.multi-file-commit-form > .commit-form-compact, .multi-file-commit-form > .commit-form-compact,
.ide-tree-header, .ide-tree-header,
.multi-file-commit-panel-header, .multi-file-commit-panel-header,
...@@ -267,6 +284,7 @@ ...@@ -267,6 +284,7 @@
} }
.md-previewer, .md-previewer,
.md table:not(.code) tbody,
.ide-empty-state { .ide-empty-state {
background-color: $border-color; background-color: $border-color;
} }
...@@ -289,6 +307,14 @@ ...@@ -289,6 +307,14 @@
} }
} }
} }
.idiff.addition {
background-color: $diff-insert;
}
.idiff.deletion {
background-color: $diff-remove;
}
} }
.navbar.theme-dark { .navbar.theme-dark {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment