From 71aa681d3603587e9e91fbc27fa5b77098497ea0 Mon Sep 17 00:00:00 2001 From: Gregory Eremin Date: Thu, 14 Mar 2013 02:20:26 +0400 Subject: [PATCH] iTerm theme switching from console --- iterm2/com.googlecode.iterm2.plist | 10 ++++-- zsh/functions/theme | 54 +++++++++++++++++++++++++----- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/iterm2/com.googlecode.iterm2.plist b/iterm2/com.googlecode.iterm2.plist index f7591b2..60cb966 100644 --- a/iterm2/com.googlecode.iterm2.plist +++ b/iterm2/com.googlecode.iterm2.plist @@ -1647,6 +1647,8 @@ MaxVertically + NSColorPanelMode + 6 NSNavLastRootDirectory ~/.dotfiles/iterm2/themes NSQuotedKeystrokeBinding @@ -1683,10 +1685,12 @@ TB Size Mode 1 + NSWindow Frame NSColorPanel + 307 274 214 309 0 0 1440 878 NSWindow Frame Preferences 304 393 924 485 0 0 1440 878 NSWindow Frame iTerm Window 0 - 0 4 1431 874 0 0 1440 878 + 419 240 570 426 0 0 1440 878 NSWindow Frame iTerm Window 1 0 452 570 426 0 0 1440 878 NSWindow Frame iTerm Window 2 @@ -2411,6 +2415,8 @@ /Users/chez/Code + NoSyncNeverRemindPrefsChangesCopy + OnlyWhenMoreTabs OpenArrangementAtStartup @@ -2507,7 +2513,7 @@ UseCompactLabel UseLionStyleFullscreen - + WebKitDefaultFontSize 11 WebKitStandardFont diff --git a/zsh/functions/theme b/zsh/functions/theme index 18d1b37..c5b96bb 100644 --- a/zsh/functions/theme +++ b/zsh/functions/theme @@ -1,12 +1,50 @@ -local sublime_conf_location=~/Library/Application\ Support/Sublime\ Text\ 2/Packages/User/Preferences.sublime-settings +local sublime_conf_location=~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/Preferences.sublime-settings local theme="$1" case $theme in -light|dark) - local sublime_conf_file="$ZSH/sublime/config-$theme" ;; -*) - local sublime_conf_file="$ZSH/sublime/config-dark" ;; -esac -rm $sublime_conf_location -cp $sublime_conf_file $sublime_conf_location +light) + +cp $ZSH/sublime/config-light $sublime_conf_location +osascript <<-END +tell application "iTerm" + repeat with myTerminal in terminals + repeat with mySession in sessions in myTerminal + tell mySession + set background color to {64842, 62778, 56626} + set bold color to {18134, 23373, 25098} + set cursor color to {21257, 26684, 28737} + set cursor_text color to {60037, 58326, 52284} + set foreground color to {21257, 26684, 28737} + set selection color to {60037, 58326, 52284} + set selected text color to {18134, 23373, 25098} + end tell + end repeat + end repeat +end tell +END +;; + +dark) + +cp $ZSH/sublime/config-dark $sublime_conf_location +osascript <<-END +tell application "iTerm" + repeat with myTerminal in terminals + repeat with mySession in sessions in myTerminal + tell mySession + set background color to {0, 7722, 9941} + set bold color to {33160, 37017, 36937} + set cursor color to {28873, 33398, 33872} + set cursor_text color to {0, 10207, 12694} + set foreground color to {28873, 33398, 33872} + set selection color to {0, 10207, 12694} + set selected text color to {33160, 37017, 36937} + end tell + end repeat + end repeat +end tell +END +;; + +esac