首先,感谢大家没有阻挡或使上张贴了这个问题,因为没有一段代码提供了依据。
当我决定再次尝试自己时,我正要为这个问题付出恩典,我经历了很多事情后才解决了这个问题。虽然,它帮助我更好地了解etherpad。
我想列出有关EtherPad的两个重要环节:
- https://github.com/ether/etherpad-lite/wiki
- 关于SRC - https://github.com/ether/etherpad-lite/wiki/Introduction-to-the-source
,如果你想了解EtherPad的或想他们是非常重要的自己做一些修改。
因此,这里是你怎么做:
在src/static/js/ace2_inner.js
,去setAuthorStyle
和替换功能:
// author color
authorStyle.backgroundColor = bgcolor;
parentAuthorStyle.backgroundColor = bgcolor;
// text contrast
if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5)
{
authorStyle.color = '#ffffff';
parentAuthorStyle.color = '#ffffff';
}else{
authorStyle.color = null;
parentAuthorStyle.color = null;
}
// anchor text contrast
if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.55)
{
anchorStyle.color = colorutils.triple2css(colorutils.complementary(colorutils.css2triple(bgcolor)));
}else{
anchorStyle.color = null;
}
有了:
authorStyle.backgroundColor = '#ffffff';
parentAuthorStyle.backgroundColor = '#ffffff';
authorStyle.color = bgcolor;
parentAuthorStyle.color = bgcolor;
,并注释:
if ((typeof info.fade) == "number")
{
bgcolor = fadeColor(bgcolor, info.fade);
}
Ofcource不要忘记重新启动过程bin/run.sh
以进行更改。
有兴趣了解其工作原理的人可以继续阅读。
因此,etherpad接收的参数已经在src/static/js/pad.js
中初始化了etherpad,所以如果你已经定义了:'userColor',当你初始化了pad时,它会在globalUserColor
的提到的文件中。
然后这个变量globalUserColor
在同一个文件中填入pad.myUserInfo.colorId
。
在
collab_client.js
现在,这colorId
被存储在cssColor
在功能tellAceAuthorInfo
和editor.setAuthorInfo
正在给参数bgcolor: cssColor
调用。
现在这个函数setAuthorInfo
存在于src/static/js/ace2_inner.js
中,该函数调用其他本地函数(相同文件)setAuthorStyle
我们已经进行了更改。
我做什么,而不是改变背景颜色与提供可变bgcolor
其实际持有userColor
:
authorStyle.backgroundColor = bgcolor;
parentAuthorStyle.backgroundColor = bgcolor;
我改变backgroundColor
为白色(#FFFFFF)和文本的颜色bgcolor
:
authorStyle.backgroundColor = '#ffffff';
parentAuthorStyle.backgroundColor = '#ffffff';
authorStyle.color = bgcolor;
parentAuthorStyle.color = bgcolor;
我也删除了:
// text contrast
if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.5)
{
authorStyle.color = '#ffffff';
parentAuthorStyle.color = '#ffffff';
}else{
authorStyle.color = null;
parentAuthorStyle.color = null;
}
// anchor text contrast
if(colorutils.luminosity(colorutils.css2triple(bgcolor)) < 0.55)
{
anchorStyle.color = colorutils.triple2css(colorutils.complementary(colorutils.css2triple(bgcolor)));
}else{
anchorStyle.color = null;
}
因为这些线根据背景选择的颜色设置文本颜色的对比度。但我已将背景设为白色并将文本颜色设置为userColor
,因此我不再需要对比度功能。
最终我也评论说:
if ((typeof info.fade) == "number")
{
bgcolor = fadeColor(bgcolor, info.fade);
}
,因为它使文字褪色时,用户不在线,至少对我来说的确如此。
就是这样。 我希望这会帮助某人想要和我一样的功能。