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


Python Theme.rgb_to_hex方法代码示例

本文整理汇总了Python中theme.Theme.rgb_to_hex方法的典型用法代码示例。如果您正苦于以下问题:Python Theme.rgb_to_hex方法的具体用法?Python Theme.rgb_to_hex怎么用?Python Theme.rgb_to_hex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在theme.Theme的用法示例。


在下文中一共展示了Theme.rgb_to_hex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OutputPane

# 需要导入模块: from theme import Theme [as 别名]
# 或者: from theme.Theme import rgb_to_hex [as 别名]

#.........这里部分代码省略.........
                                    self.intensity = ""
                                    self.set_current_colours()
                                elif payload == "no_italic":
                                    self.EndItalic()
                                elif payload == "no_underline":
                                    self.EndUnderline()
                                elif payload == "no_blink":
                                    print('Got an ANSI "no_blink"')
                                    # TODO - remove blink-code-handles style
                                elif payload == "no_conceal":
                                    print('Got an ANSI "no_conceal"')
                                elif payload == "no_strike":
                                    font = self.GetFont()
                                    font.SetStrikethrough(False)
                                    self.BeginFont(font)

                                elif payload == "framed":
                                    print('Got an ANSI "framed"')
                                elif payload == "encircled":
                                    print('Got an ANSI "encircled"')
                                elif payload == "overline":
                                    print('Got an ANSI "overline"')

                                elif payload == "no_framed_encircled":
                                    print('Got an ANSI "no_framed_encircled"')
                                elif payload == "no_overline":
                                    print('Got an ANSI "no_overline"')

                            elif command == "foreground" or command == "background":
                                if payload == "extended":
                                    subtype = codes.pop(0)
                                    # 24-bit color
                                    if subtype == 2:
                                        colour = self.theme.rgb_to_hex((codes.pop(0), codes.pop(0), codes.pop(0)))
                                    # 256-color
                                    elif subtype == 5:
                                        colour = self.theme.index256_to_hex(codes.pop(0))
                                    else:
                                        print("Got an unknown fg/bg ANSI subtype: " + str(subtype))
                                else:
                                    colour = payload

                                if command == "foreground":
                                    self.fg_colour = colour
                                else:
                                    self.bg_colour = colour
                                self.set_current_colours()
                            else:
                                print("unknown ANSI command:", command)
                    else:
                        # is a text-only chunk, check for URLs
                        if prefs.get("highlight_urls") == "True":
                            matches = re.split(utility.URL_REGEX, bit)
                            for chunk in matches:
                                if chunk is None:
                                    continue
                                if re.match(utility.URL_REGEX, chunk):
                                    self.BeginURL(chunk)
                                    self.BeginUnderline()

                                    current_intensity = self.intensity
                                    self.intensity = "normal"
                                    self.BeginTextColour(self.lookup_colour("blue"))
                                    self.intensity = current_intensity

                                    self.WriteText(chunk)
开发者ID:emersonrp,项目名称:wxpymoo,代码行数:70,代码来源:outputpane.py


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