Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineConfig({
integrations: [
// Before mdx, so MDX posts get the same code blocks.
expressiveCode({
themes: ['github-light', 'github-dark'],
themes: ['github-light', 'dark-plus'],
themeCssSelector: (theme) => `[data-theme='${theme.type}']`,
useDarkModeMediaQuery: false,
shiki: { langAlias: { st: 'smalltalk', ston: 'smalltalk' } },
Expand Down
25 changes: 24 additions & 1 deletion src/components/Mermaid.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,30 @@
const { default: mermaid } = await import('mermaid');
const draw = async () => {
const dark = document.documentElement.dataset.theme === 'dark';
mermaid.initialize({ startOnLoad: false, theme: dark ? 'dark' : 'default' });
// In the dark, the page's own soft greys rather than Mermaid's high-contrast dark theme.
const color = (name: string) => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
mermaid.initialize(
dark
? {
startOnLoad: false,
theme: 'base',
themeVariables: {
darkMode: true,
background: color('--surface'),
primaryColor: color('--code-bg'),
primaryTextColor: color('--text'),
primaryBorderColor: color('--border'),
secondaryColor: color('--accent-soft'),
tertiaryColor: color('--surface'),
lineColor: color('--muted'),
textColor: color('--text'),
clusterBkg: color('--bg'),
clusterBorder: color('--border'),
edgeLabelBackground: color('--surface'),
},
}
: { startOnLoad: false, theme: 'default' },
);
for (const diagram of diagrams) {
diagram.removeAttribute('data-processed');
diagram.textContent = diagram.dataset.source!;
Expand Down
25 changes: 13 additions & 12 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@
}

:root[data-theme='dark'] {
--bg: #14161a;
--surface: #1b1e23;
--text: #e6e7ea;
--muted: #9aa1ad;
--border: #2c3038;
--accent: #7aa7f0;
--accent-soft: #1d2a40;
--code-bg: #22262d;
--kind-guide: #5fc792;
--kind-experiment: #c29af2;
--kind-project: #7aa7f0;
--kind-news: #eb9b55;
/* VS Code's Dark Modern: soft greys and its token colours, rather than near-black and white. */
--bg: #1f1f1f;
--surface: #252526;
--text: #cccccc;
--muted: #9d9d9d;
--border: #3c3c3c;
--accent: #4daafc;
--accent-soft: #263445;
--code-bg: #2d2d2d;
--kind-guide: #73c991;
--kind-experiment: #c586c0;
--kind-project: #4daafc;
--kind-news: #ce9178;
color-scheme: dark;
}

Expand Down