Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Color
- data ColorMode
- black :: Color
- red :: Color
- green :: Color
- yellow :: Color
- blue :: Color
- magenta :: Color
- cyan :: Color
- white :: Color
- brightBlack :: Color
- brightRed :: Color
- brightGreen :: Color
- brightYellow :: Color
- brightBlue :: Color
- brightMagenta :: Color
- brightCyan :: Color
- brightWhite :: Color
- linearColor :: Integral i => i -> i -> i -> Color
- srgbColor :: Integral i => i -> i -> i -> Color
- rgbColor :: Integral i => i -> i -> i -> Color
- color240 :: Integral i => i -> i -> i -> Color
- module Graphics.Vty.Attributes.Color240
Documentation
Abstract data type representing a color.
Currently the foreground and background color are specified as points in either a:
- 16 color palette. Where the first 8 colors are equal to the 8 colors of the ISO 6429 (ANSI) 8 color palette and the second 8 colors are bright/vivid versions of the first 8 colors.
- 240 color palette. This palette is a regular sampling of the full RGB colorspace for the first 224 colors. The remaining 16 colors is a greyscale palette.
The 8 ISO 6429 (ANSI) colors are as follows:
- black (0)
- red (1)
- green (2)
- yellow (3)
- blue (4)
- magenta (5)
- cyan (6)
- white (7)
The mapping from points in the 240 color palette to colors actually displayable by the terminal depends on the number of colors the terminal claims to support. Which is usually determined by the terminfo "colors" property. If this property is not being accurately reported then the color reproduction will be incorrect.
If the terminal reports <= 16 colors then the 240 color palette points are only mapped to the 8 color palette. I'm not sure of the RGB points for the "bright" colors which is why they are not addressable via the 240 color palette.
If the terminal reports > 16 colors then the 240 color palette points are mapped to the nearest points in a ("color count" - 16) subsampling of the 240 color palette.
All of this assumes the terminals are behaving similarly to xterm and rxvt when handling colors. And that the individual colors have not been remapped by the user. There may be a way to verify this through terminfo but I don't know it.
Seriously, terminal color support is INSANE.
Instances
Generic Color Source # | |
Read Color Source # | |
Show Color Source # | |
NFData Color Source # | |
Defined in Graphics.Vty.Attributes.Color | |
Eq Color Source # | |
type Rep Color Source # | |
Defined in Graphics.Vty.Attributes.Color type Rep Color = D1 ('MetaData "Color" "Graphics.Vty.Attributes.Color" "vty-6.1-3Abw7VxkSUPE4N7JCXIsbj" 'False) (C1 ('MetaCons "ISOColor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)) :+: (C1 ('MetaCons "Color240" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8)) :+: C1 ('MetaCons "RGBColor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word8))))) |
Fixed Colors
Standard 8-color ANSI terminal color codes.
Note that these map to colors in the terminal's custom palette. For
instance, white
maps to whatever the terminal color theme uses for
white.
Use these functions if you want to make apps that fit the terminal theme.
If you want access to more/stronger colors use rgbColor
Bright/Vivid variants of the standard 8-color ANSI
brightBlack :: Color Source #
brightGreen :: Color Source #
brightYellow :: Color Source #
brightBlue :: Color Source #
brightCyan :: Color Source #
brightWhite :: Color Source #
Creating Colors From RGB
linearColor :: Integral i => i -> i -> i -> Color Source #
srgbColor :: Integral i => i -> i -> i -> Color Source #
Given RGB values in the range 0..255 inclusive, create a color using the sRGB transformation described at
https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation