主题配置是定义网站视觉风格和功能行为的核心文件,通常为 theme.configconfig.js。以下是关键配置项说明:

🧩 配置结构

# 基础配置
name: "我的主题"
version: "1.0.0"
author: "开发者"

# 视觉配置
colors:
  primary: #4F46E5
  secondary: #6366F1
  accent: #EF4444

# 功能配置
features:
  - responsive: true
  - dark_mode: true
  - sidebar: true

🎨 视觉定制

  • 主色调:控制整体风格(如 🟣 蓝色系 / 🟡 黄色系)
  • 字体设置fonts: { sans: 'Roboto', serif: 'Georgia' }
  • 图标库:支持 Font AwesomeIconify

📁 配置文件位置

主题配置文件通常位于:

/themes/your-theme-name/theme.config

/themes/your-theme-name/config.js

🔄 配置示例

export default {
  title: '文档主题',
  description: '基于 VuePress 的主题配置指南',
  theme: {
    logo: '/logo.png',
    navbar: [
      { text: '首页', link: '/' },
      { text: '配置', link: '/zh/docs/theme-configuration-details' }
    ],
    sidebar: [
      { text: '基础设置', link: '/zh/docs/theme-base-config' },
      { text: '高级功能', link: '/zh/docs/theme-advanced-features' }
    ]
  }
}

📚 扩展阅读

主题配置结构图