| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Termtab.Graphics.TermColor
Description
Query the terminal's foreground color so rasterized notation can be drawn in the user's theme color instead of a hardcoded one.
A terminal graphics image is raw pixels and cannot inherit terminal color
attributes the way text cells do. To make the notation "use the terminal's text
color" we ask the terminal for its foreground RGB via the OSC 10 query
(ESC ] 10 ; ? BEL) and paint the ink with the reply. If the terminal does not
answer (or stdin/stdout is not a TTY), we fall back to a neutral light ink.
Synopsis
- queryForegroundColor :: IO (Maybe (Word8, Word8, Word8))
- foregroundOrDefault :: IO PixelRGBA8
- defaultInk :: PixelRGBA8
- parseOSCColor :: String -> Maybe (Word8, Word8, Word8)
Documentation
queryForegroundColor :: IO (Maybe (Word8, Word8, Word8)) Source #
Query the terminal foreground color via OSC 10. Returns Nothing if
stdin/stdout is not a terminal or no reply arrives in time.
foregroundOrDefault :: IO PixelRGBA8 Source #
The terminal foreground as opaque ink, or defaultInk if unavailable.
defaultInk :: PixelRGBA8 Source #
Ink used when the terminal foreground can't be determined: opaque light gray, legible on a dark background.