Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conditionally use the dark mode for solarized CSS
Browse files Browse the repository at this point in the history
arai-a committed Jan 31, 2025
1 parent 803aa51 commit 1ddc80c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Spec.ts
Original file line number Diff line number Diff line change
@@ -1176,12 +1176,16 @@ ${await utils.readFile(path.join(__dirname, '../js/multipage.js'))}
}
`;
this.doc.head.appendChild(currentYearStyle);
this.addStyle(
this.doc.head,
`https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${
const solarizedStyle = this.doc.createElement('style');
solarizedStyle.textContent = `
@import url("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${
(hljs as any).versionString
}/styles/base16/solarized-light.min.css`,
);
}/styles/base16/solarized-light.min.css");
@import url("https://cdnjs.cloudflare.com/ajax/libs/highlight.js/${
(hljs as any).versionString
}/styles/base16/solarized-dark.min.css") (prefers-color-scheme: dark);
`;
this.doc.head.appendChild(solarizedStyle);
}

private addStyle(head: HTMLHeadElement, href: string, media?: 'all' | 'print' | 'screen') {

0 comments on commit 1ddc80c

Please sign in to comment.