本文整理汇总了Java中chatty.gui.HtmlColors.correctReadability方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlColors.correctReadability方法的具体用法?Java HtmlColors.correctReadability怎么用?Java HtmlColors.correctReadability使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chatty.gui.HtmlColors
的用法示例。
在下文中一共展示了HtmlColors.correctReadability方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: nick
import chatty.gui.HtmlColors; //导入方法依赖的package包/类
/**
* Makes a style for the given User, containing the User-object itself
* and the user-color. Changes the color to hopefully improve readability.
*
* @param user The User-object to base this style on
* @param style Attributes to base the user style on
* @return
*/
public MutableAttributeSet nick(User user, MutableAttributeSet style) {
SimpleAttributeSet userStyle;
if (style == null) {
userStyle = new SimpleAttributeSet(nick());
userStyle.addAttribute(Attribute.IS_USER_MESSAGE, true);
Color userColor = user.getColor();
// Only correct color if no custom color is defined
if (!user.hasCustomColor() && isEnabled(Setting.COLOR_CORRECTION)) {
userColor = HtmlColors.correctReadability(userColor, getBackground());
user.setCorrectedColor(userColor);
}
StyleConstants.setForeground(userStyle, userColor);
}
else {
userStyle = new SimpleAttributeSet(style);
}
userStyle.addAttribute(Attribute.USER, user);
return userStyle;
}
示例2: nick
import chatty.gui.HtmlColors; //导入方法依赖的package包/类
/**
* Makes a style for the given User, containing the User-object itself
* and the user-color. Changes the color to hopefully improve readability.
*
* @param user The User-object to base this style on
* @param style Attributes to base the user style on
* @return
*/
public MutableAttributeSet nick(User user, MutableAttributeSet style) {
SimpleAttributeSet userStyle;
if (style == null) {
userStyle = new SimpleAttributeSet(nick());
userStyle.addAttribute(Attribute.USER_MESSAGE, true);
Color userColor = user.getColor();
// Only correct color if no custom color is defined
if (!user.hasCustomColor()) {
userColor = HtmlColors.correctReadability(userColor, getBackground());
user.setCorrectedColor(userColor);
}
StyleConstants.setForeground(userStyle, userColor);
}
else {
userStyle = new SimpleAttributeSet(style);
}
userStyle.addAttribute(Attribute.USER, user);
return userStyle;
}
示例3: nick
import chatty.gui.HtmlColors; //导入方法依赖的package包/类
/**
* Makes a style for the given User, containing the User-object itself
* and the user-color. Changes the color to hopefully improve readability.
*
* @param user The User-object to base this style on
* @return
*/
public MutableAttributeSet nick(User user, MutableAttributeSet style) {
SimpleAttributeSet userStyle;
if (style == null) {
userStyle = new SimpleAttributeSet(nick());
userStyle.addAttribute(CHATTY_USER_MESSAGE, true);
Color userColor = user.getColor();
if (!user.hasChangedColor()) {
userColor = HtmlColors.correctReadability(userColor, getBackground());
user.setCorrectedColor(userColor);
}
StyleConstants.setForeground(userStyle, userColor);
}
else {
userStyle = new SimpleAttributeSet(style);
}
userStyle.addAttribute(CHATTY_USER, user);
return userStyle;
}