summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-07-30 23:05:36 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-07-30 23:05:36 +1000
commitdc2d5662cc3c299b4a750af92367bdb89c50077d (patch)
treedcfa4febf87c7bac1bc495c3020251043b32354e
parenteaf72482608c42ceb4e90d825804451e9c9021e2 (diff)
sequences: Set macOS special colors.
-rw-r--r--pywal/sequences.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/pywal/sequences.py b/pywal/sequences.py
index 5620b71..1deecf6 100644
--- a/pywal/sequences.py
+++ b/pywal/sequences.py
@@ -2,16 +2,18 @@
Send sequences to all open terminals.
"""
import glob
-import os
from .settings import CACHE_DIR, OS
from . import util
-def set_special(index, color):
+def set_special(index, color, iterm_name):
"""Convert a hex color to a special sequence."""
alpha = util.Color.alpha_num
+ if OS == "Darwin":
+ return f"\033]P{iterm_name}{color.strip('#')}\033\\"
+
if index in [11, 708] and alpha != 100:
return f"\033]{index};[{alpha}]{color}\007"
@@ -36,10 +38,10 @@ def create_sequences(colors, vte):
# Source: https://goo.gl/KcoQgP
# 10 = foreground, 11 = background, 12 = cursor foregound
# 13 = mouse foreground
- sequences.append(set_special(10, colors["special"]["foreground"]))
- sequences.append(set_special(11, colors["special"]["background"]))
- sequences.append(set_special(12, colors["special"]["cursor"]))
- sequences.append(set_special(13, colors["special"]["cursor"]))
+ sequences.append(set_special(10, colors["special"]["foreground"], "g"))
+ sequences.append(set_special(11, colors["special"]["background"], "h"))
+ sequences.append(set_special(12, colors["special"]["cursor"], "l"))
+ sequences.append(set_special(13, colors["special"]["cursor"], "l"))
# Set a blank color that isn't affected by bold highlighting.
# Used in wal.vim's airline theme.