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 website/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ In `src/styles/global.css`, keep this setup:

Do not import `tailwindcss` in that file. That import adds Preflight. Preflight overrides Starlight styles.

Docs colors are the unlayered `--sl-color-*` block in `src/styles/global.css`. The `--color-gray-*` and `--color-accent-*` scales do not change those colors.
Docs colors are the unlayered `--sl-color-*` block in `src/styles/global.css`, mapped directly to the shared OKLCH tokens. Theme state uses `html[data-theme]` (and `html[data-theme-pref]` for the 3-state toggle); do not reintroduce `.dark`.

Astro 7 sets the default of `compressHTML` to `'jsx'`. This config sets `compressHTML` to `true`. That value keeps one space between inline elements. Do not remove it.

Expand Down
43 changes: 11 additions & 32 deletions website/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ export default defineConfig({
weights: ['100 900'],
styles: ['normal'],
subsets: ['latin', 'latin-ext'],
fallbacks: ['system-ui', 'sans-serif'],
fallbacks: [
'-apple-system',
'BlinkMacSystemFont',
'Segoe UI',
'Roboto',
'Helvetica Neue',
'Noto Sans',
'Arial',
'sans-serif',
],
},
{
provider: fontProviders.fontsource(),
Expand Down Expand Up @@ -91,44 +100,14 @@ export default defineConfig({
title: 'Bub',
description: 'Build an agent in Python or customize the Bub application.',
favicon: '/favicon.ico',
head: [
{
tag: 'link',
attrs: {
rel: 'icon',
type: 'image/png',
href: '/favicon-light.png',
sizes: '64x64',
media: '(prefers-color-scheme: light)',
'data-favicon-theme': 'light',
},
},
{
tag: 'link',
attrs: {
rel: 'icon',
type: 'image/png',
href: '/favicon-dark.png',
sizes: '64x64',
media: '(prefers-color-scheme: dark)',
'data-favicon-theme': 'dark',
},
},
{
tag: 'script',
attrs: {
src: '/favicon-theme.js',
defer: true,
},
},
],
logo: {
light: './src/assets/bub-logo.png',
dark: './src/assets/bub-logo-dark.png',
alt: 'Bub',
},
components: {
Head: './src/components/StarlightHead.astro',
ThemeSelect: './src/components/ui/ThemeToggle.astro',
},
// Use the resolved file URL so Vite's module graph reliably
// includes global.css on every Starlight docs page in dev mode.
Expand Down
28 changes: 21 additions & 7 deletions website/public/favicon-theme.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
(() => {
const root = document.documentElement;
const systemTheme = window.matchMedia('(prefers-color-scheme: dark)');
const systemLight = window.matchMedia('(prefers-color-scheme: light)');
const themeColors = {
light: '#ffffff',
dark: '#0a0a0a',
};

const getTheme = () => {
const documentTheme = root.dataset.theme;
Expand All @@ -17,20 +21,30 @@
// Storage can be unavailable in privacy-restricted browser contexts.
}

return systemTheme.matches ? 'dark' : 'light';
return systemLight.matches ? 'light' : 'dark';
};

const updateFavicon = () => {
const syncThemeChrome = () => {
const theme = getTheme();
for (const icon of document.querySelectorAll('[data-favicon-theme]')) {
icon.media = icon.dataset.faviconTheme === theme ? 'all' : 'not all';
}

const themeColorMetas = document.querySelectorAll('meta[name="theme-color"]');
if (themeColorMetas.length > 0) {
const primary = themeColorMetas[0];
primary.removeAttribute('media');
primary.setAttribute('content', themeColors[theme]);
for (let i = 1; i < themeColorMetas.length; i += 1) {
themeColorMetas[i].remove();
}
}
};

updateFavicon();
new MutationObserver(updateFavicon).observe(root, {
syncThemeChrome();
new MutationObserver(syncThemeChrome).observe(root, {
attributes: true,
attributeFilter: ['class', 'data-theme'],
attributeFilter: ['data-theme'],
});
systemTheme.addEventListener('change', updateFavicon);
systemLight.addEventListener('change', syncThemeChrome);
})();
14 changes: 1 addition & 13 deletions website/src/components/Hero.astro
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class MyPlugin:

<!-- Right: code editor -->
<div
class="hero-terminal min-w-0 overflow-hidden border border-border shadow-[var(--site-shadow-elevated)]"
class="min-w-0 overflow-hidden border border-border bg-card shadow-[var(--site-shadow-elevated)] lg:mt-[4.75rem]"
>
<Code
code={exampleCode}
Expand All @@ -99,15 +99,3 @@ class MyPlugin:
</div>
</div>
</section>

<style>
.hero-terminal {
background: var(--card);
}

@media (min-width: 64rem) {
.hero-terminal {
margin-top: 4.75rem;
}
}
</style>
Loading
Loading