Zuoqiu-Yingyi / siyuan-theme-dark-plus

思源笔记的一款多功能双模式主题 | A multifunctional dual-mode theme of SiYuan Note.
GNU Affero General Public License v3.0
139 stars 14 forks source link

部分自定义主题样式失效了 #66

Closed git-zxx closed 2 years ago

git-zxx commented 2 years ago

刚刚更新了主题,重启之后发现有些自定义样式失效了,貌似light.css和dark.css的@import语句都不在了,我加上之后就好了,但是可能有别人也会出现这种情况,大佬看是不是要把导入语句加回去呢 :D

Zuoqiu-Yingyi commented 2 years ago

啊, 自定义文件是 custom-light.csscustom-dark.css

git-zxx commented 2 years ago

啊,那个light.css的意思是Dark+/style/color/light.css当时没写全,我的自定义配置文件名应该也是没错的 image 然后我看了Dark+/style/color/light.css的代码发现好像缺少了@import url(/widgets/custom-light.css);这句话,我加上之后就回到正常了

Zuoqiu-Yingyi commented 2 years ago

啊,那个light.css的意思是Dark+/style/color/light.css当时没写全,我的自定义配置文件名应该也是没错的 image 然后我看了Dark+/style/color/light.css的代码发现好像缺少了@import url(/widgets/custom-light.css);这句话,我加上之后就回到正常了

/widgets/custom-light.css/widgets/custom-light.css 两个文件是通过 theme.js 文件动态加载的, 这是因为 @import 只能在 CSS 文件开头引用, 但是用户自定义文件 custom-light.csscustom-dark.css 的优先级理应比 light.cssdark.css 更高, 因此不应使用 @import 引用 https://github.com/Zuoqiu-Yingyi/siyuan-theme-dark-plus/blob/88719c19e6abf04ce5fbbcdb1b04920e6406dfc8/theme.js#L148-L176

Zuoqiu-Yingyi commented 2 years ago

刚刚更新了主题,重启之后发现有些自定义样式失效了

设置了 custom-light.csscustom-dark.css 应该不会出现更新后自定义样式失效的问题呀

git-zxx commented 2 years ago

那应该是我这里的问题吧,每次更新总是有两个变量覆盖失败,只有到light.css文件中删除下面这两句,custom-light.css 文件里这两个变量的自定义代码才生效 / 编辑区背景颜色 | The background color of the edit area / --custom-editor-background-color: var(--custom-transparent); / 弹出窗口背景颜色 | The background color of the popover / --custom-popover-background-color: var(--custom-transparent-deeper);

Zuoqiu-Yingyi commented 2 years ago
/* 编辑区背景颜色 | The background color of the edit area /
--custom-editor-background-color: var(--custom-transparent);
/ 弹出窗口背景颜色 | The background color of the popover */
--custom-popover-background-color: var(--custom-transparent-deeper);

请检查这里注释是否正确

git-zxx commented 2 years ago

这次更新没有再失效,我看了下文档,好像注释也没问题,不知为什么上次复制过来的就是少了 * 号的,下面这个是没修改过的custom.css文件的内容,但之前几次确实更新之后就失效,这次好了,感谢!!! image