def refresh_editor(self, color_scheme):
        """
        Refresh editor settings (background and highlight colors) when color
        scheme changed.

        :param color_scheme: new color scheme.
        """
        self.editor.background = color_scheme.background
        self.editor.foreground = color_scheme.formats[
            'normal'].foreground().color()
        self.editor.whitespaces_foreground = color_scheme.formats[
            'whitespace'].foreground().color()
        try:
            mode = self.editor.modes.get('CaretLineHighlighterMode')
        except KeyError:
            pass
        else:
            mode.background = color_scheme.highlight
            mode.refresh()
        try:
            mode = self.editor.panels.get('FoldingPanel')
        except KeyError:
            pass
        else:
            mode.refresh_decorations(force=True)
        self.editor._reset_stylesheet()
Refresh editor settings (background and highlight colors) when color
        scheme changed.

        :param color_scheme: new color scheme.