st_scheme_template.py 文件源码

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

项目:sublime-text-3-packages 作者: nickjj 项目源码 文件源码
def parse_global(self):
        """Parse global settings."""

        color_settings = {}
        for item in self.csm.plist_file["settings"]:
            if item.get('scope', None) is None and item.get('name', None) is None:
                color_settings = item["settings"]
                break

        # Get general theme colors from color scheme file
        self.bground = self.strip_color(color_settings.get("background", '#FFFFFF'), simple_strip=True)
        rgba = RGBA(self.bground)
        self.lums = rgba.get_luminance()
        is_dark = self.lums <= LUM_MIDPOINT
        settings = sublime.load_settings("Preferences.sublime-settings")
        self.variables = {
            "is_dark": is_dark,
            "is_light": not is_dark,
            "sublime_version": int(sublime.version()),
            "mdpopups_version": ver.version(),
            "color_scheme": self.scheme_file,
            "use_pygments": not settings.get('mdpopups.use_sublime_highlighter', False),
            "default_formatting": settings.get('mdpopups.default_formatting', True)
        }
        self.html_border = rgba.get_rgb()
        self.fground = self.strip_color(color_settings.get("foreground", '#000000'))

        # Intialize colors with the global foreground, background, and fake html_border
        self.colors = OrderedDict()
        self.colors['.foreground'] = OrderedDict([('color', 'color: %s; ' % self.fground)])
        self.colors['.background'] = OrderedDict([('background-color', 'background-color: %s; ' % self.bground)])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号