Answers for "toggle theme sublime text"

0

toggle theme sublime text

import sublime
import sublime_plugin


class ToggleColorSchemeCommand(sublime_plugin.TextCommand):
  def run(self, edit, **args):
    settings = sublime.load_settings("Preferences.sublime-settings")

    light_theme = "Solarized Flat Light.sublime-theme" 
    dark_theme = "Material-Theme-Darker.sublime-theme"

    dark_color_scheme = "Packages/Material Theme - Mod/Material-Theme-Darker.tmTheme"
    light_color_scheme = "Packages/User/Color Highlighter/themes/Solarized Flat Light.tmTheme"

    current_theme = settings.get("theme", light_theme)

    if current_theme == light_theme:
      settings.set("theme", dark_theme)
      settings.set("color_scheme", dark_color_scheme)
    else:
      settings.set("theme", light_theme)
      settings.set("color_scheme", light_color_scheme)

    sublime.save_settings("Preferences.sublime-settings")
Posted by: Guest on May-13-2021
0

toggle theme sublime text

import sublime
import sublime_plugin


class ToggleColorSchemeCommand(sublime_plugin.TextCommand):
  def run(self, edit, **args):
    settings = sublime.load_settings("Preferences.sublime-settings")

    light_theme = "Solarized Flat Light.sublime-theme" 
    dark_theme = "Material-Theme-Darker.sublime-theme"

    dark_color_scheme = "Packages/Material Theme - Mod/Material-Theme-Darker.tmTheme"
    light_color_scheme = "Packages/User/Color Highlighter/themes/Solarized Flat Light.tmTheme"

    current_theme = settings.get("theme", light_theme)

    if current_theme == light_theme:
      settings.set("theme", dark_theme)
      settings.set("color_scheme", dark_color_scheme)
    else:
      settings.set("theme", light_theme)
      settings.set("color_scheme", light_color_scheme)

    sublime.save_settings("Preferences.sublime-settings")
Posted by: Guest on May-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language