# Path: libxyz/const.py
# PROG = u"XYZCommander"
# HOMEPAGE = u"xyzcmd.syhpoon.name"
# USER_DIR = u".xyzcmd"
# SYSTEM_PREFIX = os.getenv("XYZCMD_PREFIX", sys.prefix)
# SYSTEM_DIR = os.path.join(SYSTEM_PREFIX, "share/xyzcmd")
# CONF_DIR = u"conf"
# PLUGINS_DIR = u"plugins"
# SKINS_DIR = u"skins"
# LOCALE_DIR = u"locale"
# VFS_DRIVERS_DIR = u"vfs"
# XYZ_CONF_FILE = u"main.xyz"
# KEYS_CONF_FILE = u"keys.xyz"
# PLUGINS_CONF_FILE = u"plugins.xyz"
# ACTIONS_CONF_FILE = u"actions.xyz"
# ALIASES_CONF_FILE = u"aliases.xyz"
# ICMD_CONF_FILE = u"icmd.xyz"
# VFS_CONF_FILE = u"vfs.xyz"
# HOOKS_CONF_FILE = u"hooks.xyz"
# DEFAULT_SKIN = u"seablue"
# DEFAULT_DISPLAY_DRIVER = u"raw"
# 
# Path: libxyz/exceptions.py
# class XYZValueError(XYZError):
#     pass
# 
# Path: libxyz/ui/display.py
# def is_lowui_ge_0_9_9():
#     if hasattr(urwid, "VERSION") and urwid.VERSION >= (0, 9, 9):
#         return True
#     else:
#         return False


import copy
import re
from libxyz import const
from libxyz.exceptions import XYZValueError
from libxyz.ui.display import is_lowui_ge_0_9_9

    bg_high = property(_bg_high_get, _bg_high_set)

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    def get_palette(self, display=const.DEFAULT_DISPLAY_DRIVER):
        """
        Return urwid-compatible palette tuple
        """

        raw = display == "raw"

        fg = self.fg.color
        fg_attrs = self.fg_attrs

        # Append attributes to foreground color
        if fg_attrs is not None and is_lowui_ge_0_9_9() and raw:
            fg = ",".join([fg] + [x.color for x in fg_attrs])

        bg = self.bg.color
        mono = self.mono
        
        if mono is not None:
            mono = ",".join([x.color for x in mono])

        fg_high = self.fg_high

        if fg_high is not None:
            fg_high = fg_high.color
            

# Path: libxyz/const.py
# PROG = u"XYZCommander"
# HOMEPAGE = u"xyzcmd.syhpoon.name"
# USER_DIR = u".xyzcmd"
# SYSTEM_PREFIX = os.getenv("XYZCMD_PREFIX", sys.prefix)
# SYSTEM_DIR = os.path.join(SYSTEM_PREFIX, "share/xyzcmd")
# CONF_DIR = u"conf"
# PLUGINS_DIR = u"plugins"
# SKINS_DIR = u"skins"
# LOCALE_DIR = u"locale"
# VFS_DRIVERS_DIR = u"vfs"
# XYZ_CONF_FILE = u"main.xyz"
# KEYS_CONF_FILE = u"keys.xyz"
# PLUGINS_CONF_FILE = u"plugins.xyz"
# ACTIONS_CONF_FILE = u"actions.xyz"
# ALIASES_CONF_FILE = u"aliases.xyz"
# ICMD_CONF_FILE = u"icmd.xyz"
# VFS_CONF_FILE = u"vfs.xyz"
# HOOKS_CONF_FILE = u"hooks.xyz"
# DEFAULT_SKIN = u"seablue"
# DEFAULT_DISPLAY_DRIVER = u"raw"
# 
# Path: libxyz/exceptions.py
# class XYZValueError(XYZError):
#     pass
# 
# Path: libxyz/ui/display.py
# def is_lowui_ge_0_9_9():
#     if hasattr(urwid, "VERSION") and urwid.VERSION >= (0, 9, 9):
#         return True
#     else:
#         return False


# Path: libxyz/ui/colors.py
import copy
import re
from libxyz import const
from libxyz.exceptions import XYZValueError
from libxyz.ui.display import is_lowui_ge_0_9_9


    bg_high = property(_bg_high_get, _bg_high_set)

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    def get_palette(self, display=const.DEFAULT_DISPLAY_DRIVER):
        """
        Return urwid-compatible palette tuple
        """

        raw = display == "raw"

        fg = self.fg.color
        fg_attrs = self.fg_attrs

        # Append attributes to foreground color
        if fg_attrs is not None and is_lowui_ge_0_9_9() and raw:
            fg = ",".join([fg] + [x.color for x in fg_attrs])

        bg = self.bg.color
        mono = self.mono
        
        if mono is not None:
            mono = ",".join([x.color for x in mono])

        fg_high = self.fg_high

        if fg_high is not None:
            fg_high = fg_high.color
            

            if fg_attrs is not None and is_lowui_ge_0_9_9() and raw: