Fix fg/bg custom colors

This commit is contained in:
Yohann D'ANELLO
2021-01-07 16:49:40 +01:00
parent 4acf6804d4
commit 478a655751
3 changed files with 17 additions and 9 deletions

View File

@ -383,12 +383,21 @@ class Tile(Enum):
val = getattr(pack, self.name)
return val[0] if isinstance(val, tuple) else val
def color(self, pack: TexturePack) -> Tuple[int, int]:
def visible_color(self, pack: TexturePack) -> Tuple[int, int]:
"""
Retrieve the tuple (fg_color, bg_color) of the current Tile
if it is visible.
"""
val = getattr(pack, self.name)
return (val[2], val[4]) if isinstance(val, tuple) else \
(pack.tile_fg_visible_color, pack.tile_bg_color)
def hidden_color(self, pack: TexturePack) -> Tuple[int, int]:
"""
Retrieve the tuple (fg_color, bg_color) of the current Tile.
"""
val = getattr(pack, self.name)
return (val[1], val[2]) if isinstance(val, tuple) else \
return (val[1], val[3]) if isinstance(val, tuple) else \
(pack.tile_fg_color, pack.tile_bg_color)
def is_wall(self) -> bool: