我正在尝试自定义聊天机器人的UI。因为我目前只能更改用户气泡的字体颜色。默认情况下,字体颜色设置为黑色,我想更改为白色,我可以使用以下样式选项来更改气泡背景颜色。
const styleSet = window.WebChat.createStyleSet({
bubbleBackground: 'rgba(0, 0, 255, .1)',
bubbleFromUserBackground: 'rgba(0, 255, 0, .1)'
});
可以通过正确的语法帮助用户和Bot气泡更改字体颜色吗?
如你在Web聊天库中的defaultStyleOptions.js中所看到的,有许多内置且可访问的样式选项。你所需要做的就是分别针对用户气泡或机器人气泡的bubbleFromUserTextColor
和bubbleTextColor
属性。
const styleSet = window.WebChat.createStyleSet({
bubbleBackground: 'rgba(0, 0, 255, .1)',
bubbleTextColor: 'rgba(0, 0, 0, 1)',
bubbleFromUserBackground: 'rgba(0, 255, 0, .1)',
bubbleFromUserTextColor: 'rgba(0, 0, 0, 1)'
});
希望有帮助!
谢谢@steven Kanberg,这真的很有帮助。:)