首先,感謝大家沒有阻擋或使上張貼了這個問題,因爲沒有一段代碼提供了依據。
當我決定再次嘗試自己時,我正要爲這個問題付出恩典,我經歷了很多事情後才解決了這個問題。雖然,它幫助我更好地瞭解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);
}
,因爲它使文字褪色時,用戶不在線,至少對我來說的確如此。
就是這樣。 我希望這會幫助某人想要和我一樣的功能。