當前位置: 首頁>>代碼示例>>Python>>正文


Python Theme.index256_to_hex方法代碼示例

本文整理匯總了Python中theme.Theme.index256_to_hex方法的典型用法代碼示例。如果您正苦於以下問題:Python Theme.index256_to_hex方法的具體用法?Python Theme.index256_to_hex怎麽用?Python Theme.index256_to_hex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在theme.Theme的用法示例。


在下文中一共展示了Theme.index256_to_hex方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: OutputPane

# 需要導入模塊: from theme import Theme [as 別名]
# 或者: from theme.Theme import index256_to_hex [as 別名]

#.........這裏部分代碼省略.........
                                    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)

                                    self.EndTextColour()
                                    self.EndUnderline()
開發者ID:emersonrp,項目名稱:wxpymoo,代碼行數:70,代碼來源:outputpane.py


注:本文中的theme.Theme.index256_to_hex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。