License | BSD-3-Clause |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Swarm.Game.Entity.Cosmetic
Description
Preserve color fidelity for non-TUI rendering
Synopsis
- data NamedColor
- type RGBColor = RGB Word8
- fromHiFi :: PreservableColor -> ColorLayers RGBColor
- namedToTriple :: NamedColor -> RGBColor
- data TrueColor
- data ColorLayers a
- type PreservableColor = ColorLayers TrueColor
- getBackground :: ColorLayers a -> Maybe a
- flattenBg :: ColorLayers a -> a
- newtype WorldAttr = WorldAttr String
Documentation
data NamedColor Source #
Instances
Show NamedColor Source # | |
Defined in Swarm.Game.Entity.Cosmetic Methods showsPrec :: Int -> NamedColor -> ShowS # show :: NamedColor -> String # showList :: [NamedColor] -> ShowS # |
namedToTriple :: NamedColor -> RGBColor Source #
Since terminals can customize these named colors using themes or explicit user overrides, these color assignments are somewhat arbitrary.
High-fidelity color representation for rendering outside of the TUI.
Constructors
AnsiColor NamedColor | |
Triple RGBColor |
Instances
Show TrueColor Source # | |
ToPixel PreservableColor Source # | |
Defined in Swarm.Game.Entity.Cosmetic Methods |
data ColorLayers a Source #
A value of type ColorLayers a
represents the assignment of
foreground and/or background color to an Entity
or terrain,
where a
may be a medium-independent (i.e. "authoritative") color
representation, or medium-specific (e.g. a vty
color).
The Functor
instance facilitates easy conversion from the
authoritative color to the specialized representation.
Ignores vty
"styles", such as bold/italic/underline.
This is intended to facilitate multiple rendering mediums:
- Single pixel per world cell (one color must be chosen between foreground and background, if both are specified)
- Pixel block per world cell (can show two colors in some stylized manner)
- Glyph per world cell (can render a colored display character on a colored background)
Instances
Functor ColorLayers Source # | |
Defined in Swarm.Game.Entity.Cosmetic Methods fmap :: (a -> b) -> ColorLayers a -> ColorLayers b # (<$) :: a -> ColorLayers b -> ColorLayers a # | |
ToPixel PreservableColor Source # | |
Defined in Swarm.Game.Entity.Cosmetic Methods | |
Show a => Show (ColorLayers a) Source # | |
Defined in Swarm.Game.Entity.Cosmetic Methods showsPrec :: Int -> ColorLayers a -> ShowS # show :: ColorLayers a -> String # showList :: [ColorLayers a] -> ShowS # |
type PreservableColor = ColorLayers TrueColor Source #
getBackground :: ColorLayers a -> Maybe a Source #
flattenBg :: ColorLayers a -> a Source #
Instances
Show WorldAttr Source # | |
Eq WorldAttr Source # | |
Ord WorldAttr Source # | |