当前位置: 首页>>代码示例>>Java>>正文


Java HtmlColors.correctReadability方法代码示例

本文整理汇总了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;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:28,代码来源:ChannelTextPane.java

示例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;
}
 
开发者ID:partouf,项目名称:Chatty-Twitch-Client,代码行数:28,代码来源:ChannelTextPane.java

示例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;
}
 
开发者ID:pokemane,项目名称:TwitchChatClient,代码行数:26,代码来源:ChannelTextPane.java


注:本文中的chatty.gui.HtmlColors.correctReadability方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。