当前位置:
首页
文章
前端
详情

vuepress修改主题色

官方说明:docs/.vuepress/styles/palette.styl: 用于重写默认颜色常量,或者设置新的 stylus 颜色常量。

所以直接在.vuepress/styles/palette.styl覆盖变量即可

可调整的变量如下:

// 颜色
$accentColor = #3eaf7c
$textColor = #2c3e50
$borderColor = #eaecef
$codeBgColor = #282c34
$arrowBgColor = #ccc
$badgeTipColor = #42b983
$badgeWarningColor = darken(#ffe564, 35%)
$badgeErrorColor = #DA5961

// 布局
$navbarHeight = 3.6rem
$sidebarWidth = 20rem
$contentWidth = 740px
$homePageWidth = 960px

// 响应式变化点
$MQNarrow = 959px
$MQMobile = 719px
$MQMobileNarrow = 419px

主要因为:配置文件 config.styl 是优先提取palette.styl的变量使用的

@require '~@temp/palette.styl'

// colors
$accentColor ?= #3eaf7c
$textColor ?= #2c3e50
$borderColor ?= #eaecef
$codeBgColor ?= #282c34
$arrowBgColor ?= #ccc
$badgeTipColor ?= #42b983
$badgeWarningColor ?= darken(#ffe564, 35%)
$badgeErrorColor ?= #DA5961

// layout
$navbarHeight ?= 3.6rem
$sidebarWidth ?= 20rem
$contentWidth ?= 740px
$homePageWidth ?= 960px

// responsive breakpoints
$MQNarrow ?= 959px
$MQMobile ?= 719px
$MQMobileNarrow ?= 419px

// code
$lineNumbersWrapperWidth ?= 3.5rem
$codeLang ?= js ts html md vue css sass scss less stylus go java c sh yaml py docker dockerfile makefile

如果主题没有生效,可尝试重启服务/重启电脑/换台电脑。

一般只需要主题色即可:

$accentColor = #fb6052

博客主题

  • vuepress-theme-melodydl

免责申明:本站发布的内容(图片、视频和文字)以转载和分享为主,文章观点不代表本站立场,如涉及侵权请联系站长邮箱:xbc-online@qq.com进行反馈,一经查实,将立刻删除涉嫌侵权内容。