22
33Halo 2.0 的通用评论组件插件,为前台提供完整的评论解决方案。
44
5+ ![ Cover] ( ./images/cover.png )
6+
57## 使用方式
68
791 . 下载,目前提供以下两个下载方式:
810 - GitHub Releases:访问 [ Releases] ( https://github.com/halo-dev/plugin-comment-widget/releases ) 下载 Assets 中的 JAR 文件。
9- - Halo 应用市场:< https://halo.run/store/apps/app-YXyaD > 。
11+ - Halo 应用市场:< https://www. halo.run/store/apps/app-YXyaD > 。
10122 . 安装,插件安装和更新方式可参考:< https://docs.halo.run/user-guide/plugins > 。
1113
1214> 需要注意的是,此插件需要主题进行适配,不会主动在内容页加载评论组件。
@@ -46,84 +48,90 @@ Halo 插件的详细开发文档可查阅 [插件开发](https://docs.halo.run/c
4648
4749目前已提供的 CSS 变量:
4850
49- | 变量名 | 描述 |
50- | -------------------------------------------------------------------------| ------------------------|
51- | ` --halo-comment-widget-base-color ` | 基础文字颜色 |
52- | ` --halo-comment-widget-base-info-color ` | 非重要突出文字 |
53- | ` --halo-comment-widget-base-border-radius ` | 基础元素的圆角 |
54- | ` --halo-comment-widget-base-font-size ` | 基础字体大小 |
55- | ` --halo-comment-widget-base-line-height ` | 基础行高 |
56- | ` --halo-comment-widget-base-font-family ` | 基础字体族 |
57- | ` --halo-comment-widget-component-avatar-rounded ` | 头像的圆角大小 |
58- | ` --halo-comment-widget-component-avatar-size ` | 头像大小 |
59- | ` --halo-comment-widget-component-form-input-bg-color ` | 表单输入背景颜色 |
60- | ` --halo-comment-widget-component-form-input-color ` | 表单输入文字颜色 |
61- | ` --halo-comment-widget-component-form-input-border-color ` | 表单输入边框颜色 |
62- | ` --halo-comment-widget-component-form-input-border-color-focus ` | 表单输入焦点时边框颜色 |
63- | ` --halo-comment-widget-component-form-input-box-shadow-focus ` | 表单输入焦点时的阴影 |
64- | ` --halo-comment-widget-component-form-button-login-bg-color ` | 登录按钮背景颜色 |
65- | ` --halo-comment-widget-component-form-button-login-bg-color-hover ` | 登录按钮悬停背景颜色 |
66- | ` --halo-comment-widget-component-form-button-login-border-color ` | 登录按钮边框颜色 |
67- | ` --halo-comment-widget-component-form-button-submit-bg-color ` | 提交按钮背景颜色 |
68- | ` --halo-comment-widget-component-form-button-submit-color ` | 提交按钮文字颜色 |
69- | ` --halo-comment-widget-component-form-button-submit-border-color ` | 提交按钮边框颜色 |
70- | ` --halo-comment-widget-component-form-button-submit-border-color-hover ` | 提交按钮悬停边框颜色 |
71- | ` --halo-comment-widget-component-form-button-emoji-color ` | 表情按钮颜色 |
72- | ` --halo-comment-widget-component-comment-item-action-bg-color-hover ` | 评论项操作悬停背景颜色 |
73- | ` --halo-comment-widget-component-comment-item-action-color-hover ` | 评论项操作悬停颜色 |
74- | ` --halo-comment-widget-component-pagination-button-bg-color-hover ` | 分页按钮悬停背景颜色 |
75- | ` --halo-comment-widget-component-pagination-button-bg-color-active ` | 分页按钮活动状态背景颜色 |
76- | ` --halo-comment-widget-component-pagination-button-border-color-active ` | 分页按钮活动状态边框颜色 |
77- | ` --halo-comment-widget-component-emoji-picker-rgb-color ` | 表情选择器颜色 |
78- | ` --halo-comment-widget-component-emoji-picker-rgb-accent ` | 表情选择器强调颜色 |
79- | ` --halo-comment-widget-component-emoji-picker-rgb-background ` | 表情选择器背景颜色 |
80- | ` --halo-comment-widget-component-emoji-picker-rgb-input ` | 表情选择器输入颜色 |
81- | ` --halo-comment-widget-component-emoji-picker-color-border ` | 表情选择器边框颜色 |
82- | ` --halo-comment-widget-component-emoji-picker-color-border-over ` | 表情选择器悬停边框颜色 |
51+ | 变量名 | 描述 |
52+ | ---------------------------- | ---------------------------------------- |
53+ | ` --halo-cw-primary-1-color ` | 主要的主题色,用于按钮背景,输入框边框等 |
54+ | ` --halo-cw-primary-2-color ` | 较浅的主题色 |
55+ | ` --halo-cw-primary-3-color ` | 最浅的主题色 |
56+ | ` --halo-cw-text-1-color ` | 主要文本颜色,用于标题、正文等 |
57+ | ` --halo-cw-text-2-color ` | 次要文本颜色 |
58+ | ` --halo-cw-text-3-color ` | 辅助文本颜色 |
59+ | ` --halo-cw-muted-1-color ` | 弱化色,用于边框、分割线、背景等辅助元素 |
60+ | ` --halo-cw-muted-2-color ` | 更浅的弱化色 |
61+ | ` --halo-cw-muted-3-color ` | 最浅的弱化色 |
62+ | ` --halo-cw-base-rounded ` | 基础圆角大小 |
63+ | ` --halo-cw-avatar-rounded ` | 头像圆角大小 |
64+ | ` --halo-cw-avatar-size ` | 头像尺寸 |
65+ | ` --halo-cw-base-font-size ` | 基础字体大小 |
66+ | ` --halo-cw-base-font-family ` | 基础字体族 |
8367
8468<details >
8569<summary >点击查看 CSS 代码模板</summary >
8670
8771``` css
8872:root {
89-
90- --halo-comment-widget-base-color : ;
91- --halo-comment-widget-base-info-color : ;
92- --halo-comment-widget-base-border-radius : ;
93- --halo-comment-widget-base-font-size : ;
94- --halo-comment-widget-base-line-height : ;
95- --halo-comment-widget-base-font-family : ;
96- --halo-comment-widget-component-avatar-rounded : ;
97- --halo-comment-widget-component-avatar-size : ;
98- --halo-comment-widget-component-form-input-bg-color : ;
99- --halo-comment-widget-component-form-input-color : ;
100- --halo-comment-widget-component-form-input-border-color : ;
101- --halo-comment-widget-component-form-input-border-color-focus : ;
102- --halo-comment-widget-component-form-input-box-shadow-focus : ;
103- --halo-comment-widget-component-form-button-login-bg-color : ;
104- --halo-comment-widget-component-form-button-login-bg-color-hover : ;
105- --halo-comment-widget-component-form-button-login-border-color : ;
106- --halo-comment-widget-component-form-button-submit-bg-color : ;
107- --halo-comment-widget-component-form-button-submit-color : ;
108- --halo-comment-widget-component-form-button-submit-border-color : ;
109- --halo-comment-widget-component-form-button-submit-border-color-hover : ;
110- --halo-comment-widget-component-form-button-emoji-color : ;
111- --halo-comment-widget-component-comment-item-action-bg-color-hover : ;
112- --halo-comment-widget-component-comment-item-action-color-hover : ;
113- --halo-comment-widget-component-pagination-button-bg-color-hover : ;
114- --halo-comment-widget-component-pagination-button-bg-color-active : ;
115- --halo-comment-widget-component-pagination-button-border-color-active : ;
116- --halo-comment-widget-component-emoji-picker-rgb-color : ;
117- --halo-comment-widget-component-emoji-picker-rgb-accent : ;
118- --halo-comment-widget-component-emoji-picker-rgb-background : ;
119- --halo-comment-widget-component-emoji-picker-rgb-input : ;
120- --halo-comment-widget-component-emoji-picker-color-border : ;
121- --halo-comment-widget-component-emoji-picker-color-border-over : ;
73+ --halo-cw-primary-1-color : ;
74+ --halo-cw-primary-2-color : ;
75+ --halo-cw-primary-3-color : ;
76+
77+ --halo-cw-text-1-color : ;
78+ --halo-cw-text-2-color : ;
79+ --halo-cw-text-3-color : ;
80+
81+ --halo-cw-muted-1-color : ;
82+ --halo-cw-muted-2-color : ;
83+ --halo-cw-muted-3-color : ;
84+
85+ --halo-cw-base-rounded : ;
86+ --halo-cw-avatar-rounded : ;
87+ --halo-cw-avatar-size : ;
88+ --halo-cw-base-font-size : ;
89+ --halo-cw-base-font-family : ;
12290}
12391```
12492
12593</details >
12694
95+ <details >
96+ <summary >3.0.0 版本之前已废弃的 CSS 变量</summary >
97+
98+ | 变量名 | 描述 | 备注 |
99+ | ----------------------------------------------------------------------- | ------------------------ | -------------------------------------------------- |
100+ | ` --halo-comment-widget-base-color ` | 基础文字颜色 | 已废弃,后续使用 ` --halo-cw-text-1-color ` 代替 |
101+ | ` --halo-comment-widget-base-info-color ` | 非重要突出文字 | 已废弃,后续使用 ` --halo-cw-muted-*-color ` 代替 |
102+ | ` --halo-comment-widget-base-border-radius ` | 基础元素的圆角 | 已废弃,后续使用 ` --halo-cw-base-rounded ` 代替 |
103+ | ` --halo-comment-widget-base-font-size ` | 基础字体大小 | 已废弃,后续使用 ` --halo-cw-base-font-size ` 代替 |
104+ | ` --halo-comment-widget-base-line-height ` | 基础行高 | 已废弃 |
105+ | ` --halo-comment-widget-base-font-family ` | 基础字体族 | 已废弃,后续使用 ` --halo-cw-base-font-family ` 代替 |
106+ | ` --halo-comment-widget-component-avatar-rounded ` | 头像的圆角大小 | 已废弃,后续使用 ` --halo-cw-avatar-rounded ` 代替 |
107+ | ` --halo-comment-widget-component-avatar-size ` | 头像大小 | 已废弃,后续使用 ` --halo-cw-avatar-size ` 代替 |
108+ | ` --halo-comment-widget-component-form-input-bg-color ` | 表单输入背景颜色 | 已废弃 |
109+ | ` --halo-comment-widget-component-form-input-color ` | 表单输入文字颜色 | 已废弃 |
110+ | ` --halo-comment-widget-component-form-input-border-color ` | 表单输入边框颜色 | 已废弃 |
111+ | ` --halo-comment-widget-component-form-input-border-color-focus ` | 表单输入焦点时边框颜色 | 已废弃,后续使用 ` --halo-cw-primary-1-color ` 代替 |
112+ | ` --halo-comment-widget-component-form-input-box-shadow-focus ` | 表单输入焦点时的阴影 | 已废弃,后续使用 ` --halo-cw-primary-2-color ` 代替 |
113+ | ` --halo-comment-widget-component-form-button-login-bg-color ` | 登录按钮背景颜色 | 已废弃 |
114+ | ` --halo-comment-widget-component-form-button-login-bg-color-hover ` | 登录按钮悬停背景颜色 | 已废弃 |
115+ | ` --halo-comment-widget-component-form-button-login-border-color ` | 登录按钮边框颜色 | 已废弃 |
116+ | ` --halo-comment-widget-component-form-button-submit-bg-color ` | 提交按钮背景颜色 | 已废弃,后续使用 ` --halo-cw-primary-1-color ` 代替 |
117+ | ` --halo-comment-widget-component-form-button-submit-color ` | 提交按钮文字颜色 | 已废弃 |
118+ | ` --halo-comment-widget-component-form-button-submit-border-color ` | 提交按钮边框颜色 | 已废弃 |
119+ | ` --halo-comment-widget-component-form-button-submit-border-color-hover ` | 提交按钮悬停边框颜色 | 已废弃,后续使用 ` --halo-cw-primary-3-color ` 代替 |
120+ | ` --halo-comment-widget-component-form-button-emoji-color ` | 表情按钮颜色 | 已废弃 |
121+ | ` --halo-comment-widget-component-comment-item-action-bg-color-hover ` | 评论项操作悬停背景颜色 | 已废弃 |
122+ | ` --halo-comment-widget-component-comment-item-action-color-hover ` | 评论项操作悬停颜色 | 已废弃 |
123+ | ` --halo-comment-widget-component-pagination-button-bg-color-hover ` | 分页按钮悬停背景颜色 | 已废弃 |
124+ | ` --halo-comment-widget-component-pagination-button-bg-color-active ` | 分页按钮活动状态背景颜色 | 已废弃 |
125+ | ` --halo-comment-widget-component-pagination-button-border-color-active ` | 分页按钮活动状态边框颜色 | 已废弃 |
126+ | ` --halo-comment-widget-component-emoji-picker-rgb-color ` | 表情选择器颜色 | 已废弃 |
127+ | ` --halo-comment-widget-component-emoji-picker-rgb-accent ` | 表情选择器强调颜色 | 已废弃 |
128+ | ` --halo-comment-widget-component-emoji-picker-rgb-background ` | 表情选择器背景颜色 | 已废弃 |
129+ | ` --halo-comment-widget-component-emoji-picker-rgb-input ` | 表情选择器输入颜色 | 已废弃 |
130+ | ` --halo-comment-widget-component-emoji-picker-color-border ` | 表情选择器边框颜色 | 已废弃 |
131+ | ` --halo-comment-widget-component-emoji-picker-color-border-over ` | 表情选择器悬停边框颜色 | 已废弃 |
132+
133+ </details >
134+
127135### 配色切换方案
128136
129137根据上面提供的 CSS 变量,也可以通过定义 CSS 变量的方式为评论组件提供动态切换配色的功能。
@@ -136,33 +144,24 @@ Halo 插件的详细开发文档可查阅 [插件开发](https://docs.halo.run/c
136144 [data-color-scheme = ' auto' ] {
137145 color-scheme : dark ;
138146
139- --halo-comment-widget-base-color : #ffffff ;
140- --halo-comment-widget-base-info-color : #64748b ;
141- --halo-comment-widget-component-form-input-bg-color : #475569 ;
142- --halo-comment-widget-component-form-input-color : #ffffff ;
143- --halo-comment-widget-component-form-input-border-color : #495056 ;
144- --halo-comment-widget-component-form-input-border-color-focus : #65a3ff ;
145- --halo-comment-widget-component-form-input-box-shadow-focus : 0 0 0 0.15em #1c3966 ;
146- --halo-comment-widget-component-form-button-login-bg-color : #334155 ;
147- --halo-comment-widget-component-form-button-login-bg-color-hover : #475569 ;
148- --halo-comment-widget-component-form-button-login-border-color : #475569 ;
149- --halo-comment-widget-component-form-button-submit-border-color : #475569 ;
150- --halo-comment-widget-component-form-button-submit-border-color-hover : #64748b ;
151- --halo-comment-widget-component-form-button-emoji-color : #cbd5e1 ;
152-
153- --halo-comment-widget-component-comment-item-action-bg-color-hover : #475569 ;
154- --halo-comment-widget-component-comment-item-action-color-hover : #94a3b8 ;
155-
156- --halo-comment-widget-component-pagination-button-bg-color-hover : #475569 ;
157- --halo-comment-widget-component-pagination-button-bg-color-active : #475569 ;
158- --halo-comment-widget-component-pagination-button-border-color-active : #475569 ;
159-
160- --halo-comment-widget-component-emoji-picker-rgb-color : 222 , 222 , 221 ;
161- --halo-comment-widget-component-emoji-picker-rgb-accent : 58 , 130 , 247 ;
162- --halo-comment-widget-component-emoji-picker-rgb-background : 21 , 22 , 23 ;
163- --halo-comment-widget-component-emoji-picker-rgb-input : 0 , 0 , 0 ;
164- --halo-comment-widget-component-emoji-picker-color-border : rgba (255 , 255 , 255 , 0.1 );
165- --halo-comment-widget-component-emoji-picker-color-border-over : rgba (255 , 255 , 255 , 0.2 );
147+ --halo-cw-primary-1-color : #059669 ;
148+ --halo-cw-primary-2-color : #047857 ;
149+ --halo-cw-primary-3-color : #065f46 ;
150+
151+ --halo-cw-text-1-color : #f9fafb ;
152+ --halo-cw-text-2-color : #e5e7eb ;
153+ --halo-cw-text-3-color : #9ca3af ;
154+
155+ --halo-cw-muted-1-color : #4b5563 ;
156+ --halo-cw-muted-2-color : #374151 ;
157+ --halo-cw-muted-3-color : #1f2937 ;
158+
159+ --halo-cw-emoji-picker-rgb-color : 222 , 222 , 221 ;
160+ --halo-cw-emoji-picker-rgb-accent : 58 , 130 , 247 ;
161+ --halo-cw-emoji-picker-rgb-background : 21 , 22 , 23 ;
162+ --halo-cw-emoji-picker-rgb-input : 0 , 0 , 0 ;
163+ --halo-cw-emoji-picker-color-border : rgba (255 , 255 , 255 , 0.1 );
164+ --halo-cw-emoji-picker-color-border-over : rgba (255 , 255 , 255 , 0.2 );
166165 }
167166}
168167
@@ -171,33 +170,24 @@ Halo 插件的详细开发文档可查阅 [插件开发](https://docs.halo.run/c
171170[data-color-scheme = ' dark' ] {
172171 color-scheme : dark ;
173172
174- --halo-comment-widget-base-color : #ffffff ;
175- --halo-comment-widget-base-info-color : #64748b ;
176- --halo-comment-widget-component-form-input-bg-color : #475569 ;
177- --halo-comment-widget-component-form-input-color : #ffffff ;
178- --halo-comment-widget-component-form-input-border-color : #495056 ;
179- --halo-comment-widget-component-form-input-border-color-focus : #65a3ff ;
180- --halo-comment-widget-component-form-input-box-shadow-focus : 0 0 0 0.15em #1c3966 ;
181- --halo-comment-widget-component-form-button-login-bg-color : #334155 ;
182- --halo-comment-widget-component-form-button-login-bg-color-hover : #475569 ;
183- --halo-comment-widget-component-form-button-login-border-color : #475569 ;
184- --halo-comment-widget-component-form-button-submit-border-color : #475569 ;
185- --halo-comment-widget-component-form-button-submit-border-color-hover : #64748b ;
186- --halo-comment-widget-component-form-button-emoji-color : #cbd5e1 ;
187-
188- --halo-comment-widget-component-comment-item-action-bg-color-hover : #475569 ;
189- --halo-comment-widget-component-comment-item-action-color-hover : #94a3b8 ;
190-
191- --halo-comment-widget-component-pagination-button-bg-color-hover : #475569 ;
192- --halo-comment-widget-component-pagination-button-bg-color-active : #475569 ;
193- --halo-comment-widget-component-pagination-button-border-color-active : #475569 ;
194-
195- --halo-comment-widget-component-emoji-picker-rgb-color : 222 , 222 , 221 ;
196- --halo-comment-widget-component-emoji-picker-rgb-accent : 58 , 130 , 247 ;
197- --halo-comment-widget-component-emoji-picker-rgb-background : 21 , 22 , 23 ;
198- --halo-comment-widget-component-emoji-picker-rgb-input : 0 , 0 , 0 ;
199- --halo-comment-widget-component-emoji-picker-color-border : rgba (255 , 255 , 255 , 0.1 );
200- --halo-comment-widget-component-emoji-picker-color-border-over : rgba (255 , 255 , 255 , 0.2 );
173+ --halo-cw-primary-1-color : #059669 ;
174+ --halo-cw-primary-2-color : #047857 ;
175+ --halo-cw-primary-3-color : #065f46 ;
176+
177+ --halo-cw-text-1-color : #f9fafb ;
178+ --halo-cw-text-2-color : #e5e7eb ;
179+ --halo-cw-text-3-color : #9ca3af ;
180+
181+ --halo-cw-muted-1-color : #4b5563 ;
182+ --halo-cw-muted-2-color : #374151 ;
183+ --halo-cw-muted-3-color : #1f2937 ;
184+
185+ --halo-cw-emoji-picker-rgb-color : 222 , 222 , 221 ;
186+ --halo-cw-emoji-picker-rgb-accent : 58 , 130 , 247 ;
187+ --halo-cw-emoji-picker-rgb-background : 21 , 22 , 23 ;
188+ --halo-cw-emoji-picker-rgb-input : 0 , 0 , 0 ;
189+ --halo-cw-emoji-picker-color-border : rgba (255 , 255 , 255 , 0.1 );
190+ --halo-cw-emoji-picker-color-border-over : rgba (255 , 255 , 255 , 0.2 );
201191}
202192```
203193
0 commit comments