@open-xchange/vuepress-theme-ox
v0.4.1
Published
Open Xchange VuePress theme based on the default theme
Readme
@open-xchange/vuepress-theme-ox
Open Xchange branded VuePress theme extending the default VuePress theme with OX-specific styling and branding.
Requires @vuepress/theme-default 2.0.0-rc.141 or newer. Use 0.3.x for older versions.
Upgrading from 0.3.x? See MIGRATION.md.
Features
- Open Xchange brand colors (blue accent palette)
- Light and dark mode support
- Custom logo integration
- Enhanced typography and readability
- Feature blocks and custom containers
- Responsive navigation
- Status badges on navbar and sidebar items
Installation
As a local package (workspace)
If you're using this theme within a monorepo or workspace:
pnpm add @open-xchange/vuepress-theme-ox@workspace:*As a published package
Once published to npm:
pnpm add @open-xchange/vuepress-theme-oxUsage
In your VuePress config file (.vuepress/config.ts):
import { defineUserConfig } from 'vuepress'
import { oxTheme } from '@open-xchange/vuepress-theme-ox'
export default defineUserConfig({
theme: oxTheme({
// Add your custom configuration
nav: [
{
text: 'Home',
link: '/'
}
],
sidebar: {
'/': [
{
text: 'Guide',
items: [{ link: '/README.md' }]
}
]
},
// You can override OX defaults:
logo: { light: '/custom-logo.png', dark: '/custom-logo-dark.png' }
})
})That's it! The theme automatically includes:
- OX brand colors (blue accent palette)
- Light and dark mode support
- Custom component styles (rounded images, feature blocks)
- Navigation enhancements
- Sensible defaults (no contributors, no lastUpdated, sidebarDepth: 1)
Configuration
Theme Defaults
The oxThemeDefaults object provides:
logo:{ light: '/vuepress-theme-ox/logo.png', dark: '/vuepress-theme-ox/logo-dark.png' }contributors:falselastUpdated:falsesidebarDepth:1themePlugins.shiki:github-dark-defaultfor both colour modes, so code blocks stay dark as in 0.3.x. Other shiki options you set (themePlugins: { shiki: { lineNumbers: false } }) keep these themes; setthemes: { light, dark }or a singlethemeto replace them. The code block background stays dark whichever theme you pick, so a light theme also needs the variables under Light code blocks.
You can override any of these in your config.
Favicon
The theme automatically configures a favicon that points to /vuepress-theme-ox/favicon.ico. To use your own favicon, add it to your VuePress config:
export default defineUserConfig({
head: [
['link', { rel: 'icon', href: '/my-custom-favicon.ico' }]
],
theme: oxTheme({
// your theme config
})
})Custom Styles
The stylesheet is plain CSS, so sites need no sass. It sets the default theme's variables
for both colour modes on html:root (light) and html[data-theme='dark']. Override them in
.vuepress/styles/index.css with the same selectors; a plain :root rule is less specific
and has no effect:
html:root { --vp-c-brand: #1a5c8a; }
html[data-theme='dark'] { --vp-c-brand: #7cc0e0; }| Variable | Light | Dark |
| -------- | ----- | ---- |
| --vp-c-brand (links, active items) | #284b73 (OX navy) | #6db3d6 |
| --vp-c-brand-hover | #052d4b | #8ac4e0 |
| --vp-font-family-base | Inter | Inter |
| --vp-font-family-mono | Fira Code | Fira Code |
| --vp-code-block-bg | #161b24 | #161b24 |
Headings use Montserrat. Container and badge colours come from --ox-c-tip,
--ox-c-warning, --ox-c-danger and --ox-c-info; badges of a custom kind use
--ox-badge-default.
Light code blocks
The stylesheet sets the code block background and its surrounding colours to dark values
in both modes, to match the default github-dark-default shiki theme. These are not tied
to the shiki theme: picking a light theme alone puts light-theme tokens on a dark block,
which is unreadable. For light blocks in light mode, pick light and dark themes and
override the block colours for light mode. Line numbers, the copy button and the language
label follow the shiki theme on their own:
themePlugins: { shiki: { themes: { light: 'github-light', dark: 'github-dark-default' } } }/* .vuepress/styles/index.css: light mode only; dark mode keeps the theme's dark block */
html:root:not([data-theme='dark']) {
--vp-code-block-bg: #f6f8fa;
--vp-code-block-color: #1f2328;
--vp-code-line-highlight-color: rgb(40 75 115 / 8%);
--vp-code-tab-text-color: #59636e;
--vp-code-tab-active-text-color: #1f2328;
--ox-code-tabs-bar-bg: #eaeef2;
--ox-code-tabs-hover-bg: #dde3e9;
}Custom Components
Rounded Images
Add class round-25 to a paragraph before an image to apply rounded corners:
<p class="round-25"></p>
Feature Blocks
Use the custom container for feature highlights:
::: feature
**Feature Name**
Description of the feature with enhanced styling.
:::Status Badges
A navbar or sidebar link can carry a badge field. oxTheme() accepts it in
TypeScript (OxThemeOptions, OxBadge), including in locales:
sidebar: [
{ text: 'Release 8.52', link: '/8.52/', badge: { text: 'Upcoming', kind: 'upcoming' } },
{
text: 'Release 8.51',
link: '/8.51/',
badge: [
{ text: 'Maintained', kind: 'maintained', dot: true },
{ text: 'LTS', kind: 'lts' }
]
},
{ text: 'Release 8.48', link: '/8.48/' } // no badge, renders as before
]| Field | Type | Meaning |
| ------ | --------- | ------------------------------------------------------------------------------------ |
| text | string | The label. Required; entries without it are ignored. Also the accessible name. |
| kind | string? | Styling variant. Built in: maintained (teal), upcoming (outlined amber), lts (brand). Any other value gets ox-badge-<kind> and the neutral default styling, so you can add your own in site CSS. |
| dot | boolean?| Render a bare dot instead of a word. Useful when the same badge repeats down a list. |
Pass a single badge or an array; multiple badges render in the given order. Sidebar badges sit on the trailing edge of the item, navbar badges right after the label.
oxTheme() renders the badges into the item's text, which the default theme renders
as HTML. Only items with both link and text get badges: group labels are rendered as
plain text in dropdowns, and a missing text is filled in from the page title in the
browser, after the theme options are processed. Such badges are dropped with a warning in
the build output. Sidebar items also get docFooterText set
to the plain label (unless you set one), so the previous/next links stay without badges.
Accessibility. The badge text is part of the link text, so screen readers announce "Release 8.51 Maintained LTS". A dot keeps its text in a visually hidden span.
Assets
The theme automatically copies the following assets to your site's .vuepress/public/vuepress-theme-ox/ directory:
logo.png- Light mode logologo-dark.png- Dark mode logofavicon.ico- Site favicon
These files are placed in a subdirectory to make them easy to identify and gitignore. To exclude them from version control, add this to your .gitignore:
.vuepress/public/vuepress-theme-ox/To use your own assets instead, you can:
- Override the logo paths in your theme config (see Theme Defaults above)
- Override the favicon in your head config (see Favicon section above)
- Place your own assets in
.vuepress/public/at any path you prefer
Building
If you're modifying the theme:
# Install dependencies
pnpm install
# Build the theme
pnpm run build
# Clean build artifacts
pnpm run clean
# Preview site (docs/) with every styled element and badges
pnpm docs:devLocal Development with pnpm link
Note: When using pnpm link or link: protocol for local development, VuePress may encounter module resolution issues with the theme's client config. This is a known limitation with symlinked packages.
Workaround for local development:
Use the theme defaults without the wrapper:
import { themeDefault } from '@vuepress/theme-default' import { oxThemeDefaults } from '@open-xchange/vuepress-theme-ox' export default defineUserConfig({ theme: themeDefault({ ...oxThemeDefaults, /* config */ }) })Manually import styles in
.vuepress/styles/index.css:@import '@open-xchange/vuepress-theme-ox/lib/client/styles/index.css';
Once published to npm, you can use the clean oxTheme() wrapper as shown in the main usage example.
License
AGPL-3.0
Author
Open-Xchange
