summaryrefslogtreecommitdiff
path: root/pywal/sequences.py
diff options
context:
space:
mode:
authorDylan Araps <dylanaraps@users.noreply.github.com>2017-08-12 18:42:27 +1000
committerGitHub <noreply@github.com>2017-08-12 18:42:27 +1000
commit8be48c07fff889ed085744cc0cf585b6d0b71a89 (patch)
tree839edfa96574721cc6fc82ef18059d75ebef792e /pywal/sequences.py
parentf14aaf5a4fd1847a5316f9c41965daebc23db818 (diff)
parentc743cab4f0b74e928496c2a5052906da52acc8f7 (diff)
Merge pull request #79 from dylanaraps/35
general: Add support for Python 3.5
Diffstat (limited to 'pywal/sequences.py')
-rw-r--r--pywal/sequences.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/pywal/sequences.py b/pywal/sequences.py
index b94bd93..67c3efd 100644
--- a/pywal/sequences.py
+++ b/pywal/sequences.py
@@ -2,6 +2,7 @@
Send sequences to all open terminals.
"""
import glob
+import os
from .settings import CACHE_DIR, OS
from . import util
@@ -12,37 +13,37 @@ def set_special(index, color, iterm_name="h"):
alpha = util.Color.alpha_num
if OS == "Darwin":
- return f"\033]P{iterm_name}{color.strip('#')}\033\\"
+ return "\033[P%s%s\033\\" % (iterm_name, color.strip("#"))
if index in [11, 708] and alpha != 100:
- return f"\033]{index};[{alpha}]{color}\007"
+ return "\033]%s;[%s]%s\007" % (index, alpha, color)
- return f"\033]{index};{color}\007"
+ return "\033]%s;%s\007" % (index, color)
def set_color(index, color):
"""Convert a hex color to a text color sequence."""
if OS == "Darwin":
- return f"\033]P{index:x}{color.strip('#')}\033\\"
+ return "\033]P%x%s\033\\" % (index, color.strip("#"))
- return f"\033]4;{index};{color}\007"
+ return "\033]4;%s;%s\007" % (index, color)
def set_iterm_tab_color(color):
"""Set iTerm2 tab/window color"""
red, green, blue = util.hex_to_rgb(color)
- return [
- f"\033]6;1;bg;red;brightness;{red}\a",
- f"\033]6;1;bg;green;brightness;{green}\a",
- f"\033]6;1;bg;blue;brightness;{blue}\a",
- ]
+ return """
+ \033]6;1;bg;red;brightness;%s\a
+ \033]6;1;bg;green;brightness;%s\a
+ \033]6;1;bg;blue;brightness;%s\a
+ """ % (red, green, blue)
def create_sequences(colors, vte):
"""Create the escape sequences."""
# Colors 0-15.
- sequences = [set_color(num, col) for num, col in
- enumerate(colors["colors"].values())]
+ sequences = [set_color(index, colors["colors"]["color%s" % index])
+ for index in range(16)]
# Set a blank color that isn't affected by bold highlighting.
# Used in wal.vim's airline theme.
@@ -81,5 +82,5 @@ def send(colors, vte, cache_dir=CACHE_DIR):
for term in glob.glob(tty_pattern):
util.save_file(sequences, term)
- util.save_file(sequences, cache_dir / "sequences")
+ util.save_file(sequences, os.path.join(cache_dir, "sequences"))
print("colors: Set terminal colors.")