sequences: Send colors 0-15

This commit is contained in:
Dylan Araps 2017-07-30 22:16:41 +10:00
parent ddcd568289
commit ca63452eb1
2 changed files with 6 additions and 1 deletions

View File

@ -3,7 +3,7 @@ Send sequences to all open terminals.
""" """
import os import os
from .settings import CACHE_DIR from .settings import CACHE_DIR, OS
from . import util from . import util
@ -19,6 +19,9 @@ def set_special(index, color):
def set_color(index, color): def set_color(index, color):
"""Convert a hex color to a text color sequence.""" """Convert a hex color to a text color sequence."""
if OS == "Darwin":
return f"\033]P{index:x}{color.strip('#')}\033\\"
return f"\033]4;{index};{color}\007" return f"\033]4;{index};{color}\007"

View File

@ -10,6 +10,7 @@ Created by Dylan Araps.
""" """
import pathlib import pathlib
import platform
__version__ = "0.5.7" __version__ = "0.5.7"
@ -19,3 +20,4 @@ HOME = pathlib.Path.home()
CACHE_DIR = HOME / ".cache/wal/" CACHE_DIR = HOME / ".cache/wal/"
MODULE_DIR = pathlib.Path(__file__).parent MODULE_DIR = pathlib.Path(__file__).parent
COLOR_COUNT = 16 COLOR_COUNT = 16
OS = platform.uname()[0]