我使用jscolor並注意到它會根據所選顏色自動更改文本顏色。示例:如果我選擇了黑色背景色,它會自動將文本顏色更改爲白色。反正有禁用此功能?JSColor自動文本顏色變化
0
A
回答
0
儒略:
註釋出的代碼從JSColor
this.styleElement = target; // where to reflect current color
以下行它調用設定目標輸入字段的樣式的功能。
0
試圖找到這樣的:
this.exportColor = function(flags) {
if(!(flags & leaveValue) && valueElement) {
var value = this.toString();
if(this.caps) { value = value.toUpperCase(); }
if(this.hash) { value = '#'+value; }
valueElement.value = value;
}
if(!(flags & leaveStyle) && styleElement) {
styleElement.style.backgroundImage = "none";
styleElement.style.backgroundColor =
'#'+this.toString();
styleElement.style.color =
0.213 * this.rgb[0] +
0.715 * this.rgb[1] +
0.072 * this.rgb[2]
< 0.5 ? '#FFF' : '#000';
}
if(!(flags & leavePad) && isPickerOwner()) {
redrawPad();
}
if(!(flags & leaveSld) && isPickerOwner()) {
redrawSld();
}
};
編輯這些行:
styleElement.style.color =
0.213 * this.rgb[0] +
0.715 * this.rgb[1] +
0.072 * this.rgb[2]
< 0.5 ? '#FFF' : '#000';
到也許
styleElement.style.color =
0.213 * this.rgb[0] +
0.715 * this.rgb[1] +
0.072 * this.rgb[2]
< 0.5 ? '#000' : '#000';
,如果你想讓它稍微整齊
styleElement.style.color = '#000';
這部作品隱藏文本完全
styleElement.style.color = 'transparent';
0
加入styleElement.style.color = 'transparent';
可以從輸入字段中刪除文本值,但那麼它不會對「字體顏色」的工作屬性。
相反,我施加
styleElement.style.color = '#' + this.toString();
從輸入字段和字體顏色屬性此除去文本值也在努力。
感謝
0
發現下面的源文件代碼:
if (this.valueElement) {
if (jsc.isElementType(this.valueElement, 'input')) {
var updateField = function() {
THIS.fromString(THIS.valueElement.value, jsc.leaveValue);
jsc.dispatchFineChange(THIS);
};
jsc.attachEvent(this.valueElement, 'keyup', updateField);
jsc.attachEvent(this.valueElement, 'input', updateField);
jsc.attachEvent(this.valueElement, 'blur', blurValue);
this.valueElement.setAttribute('autocomplete', 'off');
}
}
只是評論者的attachEvent 例如,如果你不想要的文本框,從顏色面板中選取顏色後更新它的背景色,只是評論「輸入」行。
相關問題
- 1. CSS3動畫文本顏色變化
- 2. jQuery文本顏色變化動畫
- 3. 文本顏色變化(8086)
- 4. 變化的UISearchBar文本顏色9+
- 5. 變化的iOS 7 morenavigationcontroller文本顏色
- 6. FullCalendar事件文本顏色變化
- 7. LibreOffice的海量文本顏色變化
- 8. 文本顏色沒有變化TabWidget
- 9. 文本框驗證和顏色變化
- 10. Android的ListView的文本顏色變化
- 11. 安卓菜單文本顏色變化
- 12. jQuery動畫顏色變化
- 13. Ios:uibutton顏色隨時間變化自動變化
- 14. '自動對比'文本顏色在gridview?
- 15. 滾動時平滑顏色變化的粘性標題文本
- 16. ActionBar動態標籤文本顏色變化
- 17. 當背景變化時動態更改文本顏色(javascript)
- 18. 基於背景圖像顏色自動對比文本顏色
- 19. Android:文本顏色不變
- 20. UITextView文本顏色不變
- 21. 顏色改變文本
- 22. 用jQuery滾動動態顏色變化
- 23. CKEditor文本顏色按鈕不改變文本顏色
- 24. UIButton顏色變化
- 25. VS2010顏色變化
- 26. UIButton顏色變化
- 27. jquery顏色變化
- 28. Datagridview顏色變化
- 29. BufferedImage顏色變化
- 30. AS3顏色變化
@BriceCoustillas - 謝謝刪除 – ncm