【发布时间】:2018-06-26 11:57:50
【问题描述】:
有时,我直接在生产文件上工作(我知道它非常丑陋并且存在一些风险,但目前我别无选择)。我想要一种方法来轻松识别我正在处理生产文件。我可以处理 file_name 因为生产文件位于生产文件夹(或等效文件夹)中。所以我开始了一个 Sublime Text 插件来改变标签背景或代码背景为另一种颜色。
我可以显示样式信息,但我不知道如何更改此样式...
早期插件:
import sublime, sublime_plugin
class TestStCommand(sublime_plugin.TextCommand):
def run(self, edit):
if "production" in str(self.view.file_name()):
print("===== self.view.style() =====")
print(self.view.style())
插件输出:
===== self.view.style() =====
{'active_guide': '#7a4815', 'find_highlight': '#ffe894', 'inactive_selection_foreground': '#f8f8f2', 'background': '#282923', 'selection_foreground': '#f8f8f2', 'highlight': '#c4c4bd', 'selection': '#48473d', 'rulers': '#5c5c56', 'selection_border': '#212117', 'shadow': '#141411', 'accent': '#67d8ef', 'misspelling': '#f92472', 'gutter': '#282923', 'guide': '#474842', 'stack_guide': '#7a4815', 'line_highlight': '#3e3d32', 'foreground': '#f8f8f2', 'gutter_foreground': '#90908a', 'minimap_border': '#90908a', 'caret': '#f8f8f1', 'invisibles': '#70716b', 'inactive_selection': '#383830', 'find_highlight_foreground': '#000000'}
你能给我一种在 Sublime Text 插件中以编程方式修改主题(或颜色)的方法吗?
【问题讨论】:
标签: python ide sublimetext3