2024-03-22 01:09:57 +08:00

71 lines
1.7 KiB
Markdown

---
title: 自定义样式
author: pengzhanbo
icon: icon-park-outline:theme
createTime: 2024/03/04 20:18:52
permalink: /guide/custom-style/
---
## 主题定制
支持自定义样式。
该功能由 [@vuepress/plugin-palette](https://v2.vuepress.vuejs.org/zh/reference/plugin/palette.html) 提供支持。
主题使用 [SASS](https://sass-lang.com/) 作为 CSS 预处理器。
用户可以通过 [style 文件](#style-文件) 来添加额外的样式。
## Style 文件
Style 文件的路径是 `.vuepress/styles/index.scss`
你可以在这里添加额外的样式,或者覆盖默认样式:
``` scss
:root {
scroll-behavior: smooth;
}
```
你也可以利用它来覆盖默认主题的预定义 CSS 变量。
以下是部分预定义变量, 完整列表请参考 [vars.scss](https://github.com/pengzhanbo/vuepress-theme-plume/blob/main/theme/src/client/styles/vars.scss)
```scss
:root {
/** 主题颜色 */
--vp-c-brand-1: #5086a1;
--vp-c-brand-2: #6aa1b7;
--vp-c-brand-3: #8cccd5;
--vp-c-brand-soft: rgba(131, 208, 218, 0.314);
/** 背景颜色 */
--vp-c-bg: #ffffff;
--vp-c-bg-alt: #f6f6f7;
--vp-c-bg-elv: #ffffff;
--vp-c-bg-soft: #f6f6f7;
/** 文本颜色 */
--vp-c-text-1: rgba(60, 60, 67);
--vp-c-text-2: rgba(60, 60, 67, 0.78);
--vp-c-text-3: rgba(60, 60, 67, 0.56);
}
.dark {
--vp-c-brand-1: #8cccd5;
--vp-c-brand-2: #6aa1b7;
--vp-c-brand-3: #5086a1;
--vp-c-brand-soft: rgba(131, 208, 218, 0.314);
--vp-c-bg: #1b1b1f;
--vp-c-bg-alt: #161618;
--vp-c-bg-elv: #202127;
--vp-c-bg-soft: #202127;
--vp-c-text-1: rgba(255, 255, 245, 0.86);
--vp-c-text-2: rgba(235, 235, 245, 0.6);
--vp-c-text-3: rgba(235, 235, 245, 0.38);
}
```