在 Stani Python 编辑器中更改空白颜色

发布于 2024-10-19 06:03:20 字数 2684 浏览 1 评论 0原文

我弄清楚了如何编辑 SPE 颜色的外观。一切正常,除非我尝试更改空白颜色:空白仍然是白色。下面是显示空白背景的值输入的代码片段。如何更改空白颜色?

# Global default styles for all languages
            self.StyleSetSpec(wx_stc.STC_STYLE_DEFAULT,     "face:%(mono)s,size:%(size)d" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_LINENUMBER,  "back:#C0C0C0,face:%(mono)s,size:%(size)d" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_CONTROLCHAR, "face:%(mono)s" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
            self.StyleSetSpec(wx_stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")

            # Python styles
            # White space
            self.StyleSetSpec(wx_stc.STC_P_DEFAULT, "face:%(mono)s, back:#3366CC, size:%(size)d" % self.faces)
            # Comment
            self.StyleSetSpec(wx_stc.STC_P_COMMENTLINE, "face:%(mono)s,fore:#330099,back:#C0C0C0,italic,size:%(size)d" % self.faces)
            # Number
            self.StyleSetSpec(wx_stc.STC_P_NUMBER, "face:%(mono)s,fore:#00CC00,size:%(size)d" % self.faces)
            # String
            self.StyleSetSpec(wx_stc.STC_P_STRING, "face:%(mono)s,fore:#3399FF,size:%(size)d" % self.faces)
            # Single quoted string
            self.StyleSetSpec(wx_stc.STC_P_CHARACTER, "face:%(mono)s,fore:#7F007F,size:%(size)d" % self.faces)
            # Keyword
            self.StyleSetSpec(wx_stc.STC_P_WORD, "face:%(mono)s,fore:#339900,bold,size:%(size)d" % self.faces)
            # Triple quotes
            self.StyleSetSpec(wx_stc.STC_P_TRIPLE, "face:%(mono)s,fore:#FF3300,size:%(size)d" % self.faces)
            # Triple double quotes
            self.StyleSetSpec(wx_stc.STC_P_TRIPLEDOUBLE, "face:%(mono)s,fore:#7F0000,size:%(size)d" % self.faces)
            # Class name definition
            self.StyleSetSpec(wx_stc.STC_P_CLASSNAME, "face:%(mono)s,fore:#0000FF,bold,underline,size:%(size)d" % self.faces)
            # Function or method name definition
            self.StyleSetSpec(wx_stc.STC_P_DEFNAME, "face:%(mono)s,fore:#0066CC,bold,size:%(size)d" % self.faces)
            # Operators
            self.StyleSetSpec(wx_stc.STC_P_OPERATOR, "face:%(mono)s,bold,size:%(size)d" % self.faces)
            # Identifiers
            self.StyleSetSpec(wx_stc.STC_P_IDENTIFIER, "")
            # Comment-blocks
            self.StyleSetSpec(wx_stc.STC_P_COMMENTBLOCK, "face:%(mono)s,fore:#003300,back:#C0C0C0,italic,size:%(size)d" % self.faces)
            # End of line where string is not closed
            self.StyleSetSpec(wx_stc.STC_P_STRINGEOL, "face:%(mono)s,fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % self.faces)

I figured out how to edit the looks of SPE colors. Everything works except when I try change the whitespace color: whitespace remains white. Below is a code snippet showing value input for the whitespace background. How can I change the whitespace color?

# Global default styles for all languages
            self.StyleSetSpec(wx_stc.STC_STYLE_DEFAULT,     "face:%(mono)s,size:%(size)d" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_LINENUMBER,  "back:#C0C0C0,face:%(mono)s,size:%(size)d" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_CONTROLCHAR, "face:%(mono)s" % self.faces)
            self.StyleSetSpec(wx_stc.STC_STYLE_BRACELIGHT,  "fore:#FFFFFF,back:#0000FF,bold")
            self.StyleSetSpec(wx_stc.STC_STYLE_BRACEBAD,    "fore:#000000,back:#FF0000,bold")

            # Python styles
            # White space
            self.StyleSetSpec(wx_stc.STC_P_DEFAULT, "face:%(mono)s, back:#3366CC, size:%(size)d" % self.faces)
            # Comment
            self.StyleSetSpec(wx_stc.STC_P_COMMENTLINE, "face:%(mono)s,fore:#330099,back:#C0C0C0,italic,size:%(size)d" % self.faces)
            # Number
            self.StyleSetSpec(wx_stc.STC_P_NUMBER, "face:%(mono)s,fore:#00CC00,size:%(size)d" % self.faces)
            # String
            self.StyleSetSpec(wx_stc.STC_P_STRING, "face:%(mono)s,fore:#3399FF,size:%(size)d" % self.faces)
            # Single quoted string
            self.StyleSetSpec(wx_stc.STC_P_CHARACTER, "face:%(mono)s,fore:#7F007F,size:%(size)d" % self.faces)
            # Keyword
            self.StyleSetSpec(wx_stc.STC_P_WORD, "face:%(mono)s,fore:#339900,bold,size:%(size)d" % self.faces)
            # Triple quotes
            self.StyleSetSpec(wx_stc.STC_P_TRIPLE, "face:%(mono)s,fore:#FF3300,size:%(size)d" % self.faces)
            # Triple double quotes
            self.StyleSetSpec(wx_stc.STC_P_TRIPLEDOUBLE, "face:%(mono)s,fore:#7F0000,size:%(size)d" % self.faces)
            # Class name definition
            self.StyleSetSpec(wx_stc.STC_P_CLASSNAME, "face:%(mono)s,fore:#0000FF,bold,underline,size:%(size)d" % self.faces)
            # Function or method name definition
            self.StyleSetSpec(wx_stc.STC_P_DEFNAME, "face:%(mono)s,fore:#0066CC,bold,size:%(size)d" % self.faces)
            # Operators
            self.StyleSetSpec(wx_stc.STC_P_OPERATOR, "face:%(mono)s,bold,size:%(size)d" % self.faces)
            # Identifiers
            self.StyleSetSpec(wx_stc.STC_P_IDENTIFIER, "")
            # Comment-blocks
            self.StyleSetSpec(wx_stc.STC_P_COMMENTBLOCK, "face:%(mono)s,fore:#003300,back:#C0C0C0,italic,size:%(size)d" % self.faces)
            # End of line where string is not closed
            self.StyleSetSpec(wx_stc.STC_P_STRINGEOL, "face:%(mono)s,fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % self.faces)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

毁我热情 2024-10-26 06:03:20

评论:如果将数据和代码分开,可能会更容易阅读配置:

settings = [
 "STYLE_DEFAULT", "face:%(mono)s,size:%(size)d",
 "STYLE_LINENUMBER",  "back:#C0C0C0,face:%(mono)s,size:%(size)d",
 ...
 "P_COMMENTBLOCK", "face:%(mono)s,fore:#003300,back:#C0C0C0,italic,size:%(size)d",
 "P_STRINGEOL", "face:%(mono)s,fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d",
]

for name, value in zip(*[iter(settings)]*2):
    self.StyleSetSpec(getattr(wx_stc, "STC_"+name), value % self.faces)

Comment: It might be easier to read the configuration if you separate the data and the code:

settings = [
 "STYLE_DEFAULT", "face:%(mono)s,size:%(size)d",
 "STYLE_LINENUMBER",  "back:#C0C0C0,face:%(mono)s,size:%(size)d",
 ...
 "P_COMMENTBLOCK", "face:%(mono)s,fore:#003300,back:#C0C0C0,italic,size:%(size)d",
 "P_STRINGEOL", "face:%(mono)s,fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d",
]

for name, value in zip(*[iter(settings)]*2):
    self.StyleSetSpec(getattr(wx_stc, "STC_"+name), value % self.faces)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文