-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathsync-color-themes
executable file
·257 lines (200 loc) · 7.69 KB
/
sync-color-themes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
#!/bin/bash
#
# Download and install latest versions of Squirrelsong themes for supported apps.
# > More information: <https://sapegin.me/squirrelsong/>.
#
# > This script syncs color themes for:
# > [x] Bat
# > [x] Bear
# > [x] Vivaldi
# > [x] Chrome DevTools
# > [x] CotEditor
# > [x] Marta
# > [x] Syntax Highlight
# > [x] Ghostty
# > [/] Ice
# > [/] Slack
# > [/] Telegram
# > [/] macOS
#
# - Get themes from the Squirrelsong repo:
#
# `sync-color-themes`
#
# ---
# Author: Nick Plekhanov, https://nikkhan.com/
# License: MIT
# https://github.com/nicksp/dotfiles
set -euo pipefail
cd "$(dirname "$0")/.."
RED=$(tput setaf 1)
CYAN=$(tput setaf 6)
BOLD=$(tput bold)
UNDERLINE=$(tput sgr 0 1)
RESET=$(tput sgr0)
HIGHLIGHT=$(tput sgr 0 1)
warning() {
echo "$RED"
echo "/!\\ $1 /!\\"
echo "$RESET"
}
header() {
echo
echo -e "${UNDERLINE}${CYAN}${1}${RESET}"
echo
}
decode_filename() {
encoded_filename="$1"
decoded_filename="$(echo "$encoded_filename" | sed 's/%20/ /g')"
echo "$decoded_filename"
}
REPO_ROOT="https://raw.githubusercontent.com/sapegin/squirrelsong/master"
DEST_DIR="$(pwd)"
LOCAL_THEMES_DIR="$HOME/Documents/MYDATA/Color Themes"
# Download to dotfiles directory
local_install() {
local from_file="$1"
local to_dir="$2"
local filename
filename="$(basename "$from_file")"
filename_normalized="$(decode_filename "$filename")"
sudo curl "$REPO_ROOT/$from_file" -o "$DEST_DIR/$to_dir/$filename_normalized"
}
# Download to app-specific system dirs
system_install() {
local from="$1"
local to="$2"
sudo curl "$REPO_ROOT/$from" -o "$to"
}
# Download to a local data directory
my_data_install() {
local from_file="$1"
local to_dir="$2"
local filename
local dest
filename="$(basename "$from_file")"
filename_normalized="$(decode_filename "$filename")"
# Ensure destination exists
mkdir -p "$LOCAL_THEMES_DIR/$to_dir"
if [[ "$from_file" == https://* ]]; then
local archive="$LOCAL_THEMES_DIR/$filename_normalized"
sudo curl -L "$from_file" -o "$archive"
# Check if the download was successful
if [ $? -eq 0 ]; then
unzip -qo "$archive" "${to_dir}/*" -d "$LOCAL_THEMES_DIR"
rm -f "$archive"
echo "File extracted successfully to: ${UNDERLINE}${LOCAL_THEMES_DIR}/${to_dir}${RESET}"
else
echo "Error: Failed to download the file."
exit 1
fi
else
dest="$LOCAL_THEMES_DIR/$to_dir/$filename_normalized"
sudo curl -L "$REPO_ROOT/$from_file" -o "$dest"
# Check if the download was successful
if [ $? -eq 0 ]; then
echo "File downloaded successfully to: ${UNDERLINE}${dest}${RESET}"
else
echo "Error: Failed to download the file."
exit 1
fi
fi
}
# Ask for the administrator password upfront
warning "Activate sudo"
sudo echo "Sudo activated!"
echo
#
# Ghostty: https://github.com/sapegin/squirrelsong/tree/master/themes/Ghostty
#
header "Installing Ghostty theme..."
local_install "themes/Ghostty/Squirrelsong%20Dark" "tilde/.config/ghostty/themes"
echo "🌈 A new color theme has been installed and ready to use"
#
# Bat: https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-themes
# Theme: https://github.com/sapegin/squirrelsong/tree/master/themes/Sublime%20Text
#
header "Installing Bat theme..."
local_install "themes/Sublime%20Text/Squirrelsong%20Dark/Squirrelsong%20Dark.tmTheme" "tilde/.config/bat/themes"
# Update the binary cache
bat cache --build
echo "🌈 A new color theme has been installed and ready to use"
#
# Bear: https://github.com/sapegin/squirrelsong/tree/master/themes/Bear
#
header "Installing Bear theme..."
bear_themes_dir="/Applications/Bear.app/Contents/Frameworks/BearCore.framework/Versions/A/Resources"
sudo command rm -f "$bear_themes_dir/Red Graphite.theme"
system_install "themes/Bear/Squirrelsong%20Light.theme" "$bear_themes_dir/Red Graphite.theme"
echo "🌈 Now choose ${HIGHLIGHT}Red Graphite${RESET} theme in Bear settings"
#
# Marta: https://github.com/sapegin/squirrelsong/tree/master/themes/Marta
#
header "Installing Marta theme..."
marta_app_themes_dir="$HOME/Library/Application Support/org.yanex.marta/Themes"
marta_terminal_themes_dir="/Applications/Marta.app/Contents/Resources/Themes"
sudo command rm -f "$marta_terminal_themes_dir/SquirrelsongLight.ettyTheme"
system_install "themes/Marta/Squirrelsong%20Light.theme" "$marta_app_themes_dir/Squirrelsong Light.theme"
system_install "themes/Marta/SquirrelsongLight.ettyTheme" "$marta_terminal_themes_dir/SquirrelsongLight.ettyTheme"
echo "🌈 Point to new themes in Marta preferences and restart the app for the changes to take effect"
#
# Syntax Highlight: https://github.com/sapegin/squirrelsong/tree/master/themes/Highlight
#
header "Installing Syntax Highlight theme..."
local_install "themes/Highlight/Squirrelsong%20Light.theme" "syntax-highlight/themes"
echo "🌈 Import ${HIGHLIGHT}Squirrelsong Light.theme${RESET} in ${BOLD}Syntax Highlight − Settings${RESET} and then select the theme under ${BOLD}General − Color scheme${RESET} for ${BOLD}Light${RESET} and ${BOLD}Dark${RESET} modes"
#
# Vivaldi: https://github.com/sapegin/squirrelsong/tree/master/themes/Vivaldi
#
header "Installing Vivaldi theme..."
my_data_install "themes/Vivaldi/Squirrelsong%20Light.zip" "squirrelsong-master/themes/Vivaldi"
echo ""
echo "🌈 Follow these steps to install the theme:"
echo ""
echo "− Open ${BOLD}Settings${RESET}, then ${BOLD}Themes${RESET}."
echo "− Press ${BOLD}Open Theme...${RESET} button."
echo "− Select ${HIGHLIGHT}Squirrelsong Light.zip${RESET}."
echo "− Select ${BOLD}Squirrelsong Light${RESET} in ${BOLD}Theme${RESET} list."
#
# CotEditor: https://github.com/sapegin/squirrelsong/tree/master/themes/CotEditor
#
header "Installing CotEditor theme..."
my_data_install "themes/CotEditor/Squirrelsong%20Light.cottheme" "squirrelsong-master/themes/CotEditor"
echo ""
echo "🌈 Follow these steps to install the theme:"
echo ""
echo "− Open ${BOLD}Settings${RESET}, then ${BOLD}Appearance${RESET}."
echo "− Import ${HIGHLIGHT}Squirrelsong Light.cottheme${RESET}"
echo "− Select ${BOLD}Squirrelsong Light${RESET} in ${BOLD}Theme${RESET} list."
#
# Chrome DevTools: https://github.com/sapegin/squirrelsong/tree/master/themes/Chrome%20DevTools
#
header "Installing Chrome DevTools theme..."
my_data_install "https://github.com/sapegin/squirrelsong/archive/refs/heads/master.zip" "squirrelsong-master/themes/Chrome DevTools/extension-light"
echo ""
echo "🌈 Follow these steps to install the extension:"
echo ""
echo "− Go to chrome://extensions in your browser."
echo "− Turn on ${BOLD}Developer mode${RESET}."
echo "− Press ${BOLD}Load unpacked${RESET} button."
echo "− Select the ${HIGHLIGHT}Chrome DevTools/extension-light${RESET} folder of this repository."
echo "− Open DevTools settings."
echo "− Make sure that the ${BOLD}Light${RESET} theme is selected in the ${BOLD}Preferences${RESET} → ${BOLD}Appearance${RESET} section."
echo "− Make sure that the ${BOLD}Allow extensions to load custom stylesheets${RESET} checkbox is selected in the ${BOLD}Experiments${RESET} section."
# --- 8< -- 8< ---
#
# Ice: https://github.com/sapegin/squirrelsong/tree/master/themes/Ice
#
header "☕ Install Ice theme: https://github.com/sapegin/squirrelsong/tree/master/themes/Ice"
#
# Slack: https://github.com/sapegin/squirrelsong/tree/master/themes/Slack
#
header "☕ Install Slack theme: https://github.com/sapegin/squirrelsong/tree/master/themes/Slack"
#
# Telegram: https://github.com/sapegin/squirrelsong/tree/master/themes/Telegram
#
header "☕ Install Telegram theme: https://github.com/sapegin/squirrelsong/tree/master/themes/Telegram"
#
# macOS: https://github.com/sapegin/squirrelsong/tree/master/themes/macOS
#
header "☕ Tweak macOS colors: https://github.com/sapegin/squirrelsong/tree/master/themes/macOS"