infoprovider.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:KodiDevKit 作者: phil65 项目源码 文件源码
def get_color_info_html(self, color_string):
        """
        return formatted info for *color_string, taken from color xmls (default + themes + core).
        """
        color_info = ""
        for item in self.get_colors():
            if item["name"] == color_string:
                color_hex = "#" + item["content"][2:]
                cont_color = utils.get_contrast_color(color_hex)
                alpha_percent = round(int(item["content"][:2], 16) / (16 * 16) * 100)
                color_info += '%s&nbsp;<a href="test" style="background-color:%s;color:%s">%s</a> %d %% alpha<br>' % (os.path.basename(item["file"]), color_hex, cont_color, item["content"], alpha_percent)
        if color_info:
            return color_info
        if all(c in string.hexdigits for c in color_string) and len(color_string) == 8:
            color_hex = "#" + color_string[2:]
            cont_color = utils.get_contrast_color(color_hex)
            alpha_percent = round(int(color_string[:2], 16) / (16 * 16) * 100)
            return '<a href="test" style="background-color:%s;color:%s">%d %% alpha</a>' % (color_hex, cont_color, alpha_percent)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号