Skip to content

Commit

Permalink
feature: mermaid diagrams now support darkMode (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzturc committed Oct 7, 2022
1 parent 538f569 commit afe8ded
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"obsidian": "^0.12.17",
"reveal.js": "^4.2.1",
"reveal.js-menu": "^2.1.0",
"reveal.js-mermaid-plugin": "^0.0.3",
"reveal.js-mermaid-plugin": "^1.0.0",
"reveal.js-plugins": "^4.1.5",
"reveal.js-elapsed-time-bar": "https://github.com/tkrkt/reveal.js-elapsed-time-bar.git",
"reveal-pointer": "https://github.com/burnpiro/reveal-pointer.git",
Expand Down
7 changes: 6 additions & 1 deletion src/template/reveal.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@
}

var bgColor = getComputedStyle(document.documentElement).getPropertyValue('--r-background-color').trim();
var isLight = isLight(bgColor);

if(isLight(bgColor)){
if(isLight){
document.body.classList.add('has-light-background');
} else {
document.body.classList.add('has-dark-background');
Expand Down Expand Up @@ -213,6 +214,10 @@
smartypants: false,
},

mermaid: {
theme: isLight ? 'default' : 'dark',
},

{{#enableCustomControls}}
customcontrols: {
controls: [
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5800,10 +5800,10 @@
"resolved" "https://registry.npmjs.org/reveal.js-menu/-/reveal.js-menu-2.1.0.tgz"
"version" "2.1.0"

"reveal.js-mermaid-plugin@^0.0.3":
"integrity" "sha512-9bmycto26MWXX8KpNJSwYb7YyGW3NI6M3QmL0iBr3VM8hb3TkU57lJ3POLc+lacGowg/H0lVOC4pQYY3249foA=="
"resolved" "https://registry.npmjs.org/reveal.js-mermaid-plugin/-/reveal.js-mermaid-plugin-0.0.3.tgz"
"version" "0.0.3"
"reveal.js-mermaid-plugin@^1.0.0":
"integrity" "sha512-AGwin9D93IALLZKt7gxcBIn0om0P+XXmX/T66n+gq87DOqalnSABYbuOldjy7kQBKLMaORx4249C5QFQhvBdBg=="
"resolved" "https://registry.npmjs.org/reveal.js-mermaid-plugin/-/reveal.js-mermaid-plugin-1.0.0.tgz"
"version" "1.0.0"

"reveal.js-plugins@^4.1.5":
"integrity" "sha512-adbokVdKhXlPx+zyP+ot6sF21QVHfENucYE40C2pn1oDkihaZfo34CpgK3Rd/B3nlFX/1Xgrd/rw09QgkeDZfw=="
Expand Down

0 comments on commit afe8ded

Please sign in to comment.