rainbow 0.18.0.0 → 0.20.0.0
raw patch · 4 files changed
+58/−66 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Rainbow: Both :: Color8 -> Maybe Color256 -> Both
- Rainbow: bold256off :: Chunk
- Rainbow: bold8off :: Chunk
- Rainbow: boldOff :: Chunk
- Rainbow: both256 :: Both -> Maybe Color256
- Rainbow: both8 :: Both -> Color8
- Rainbow: data Both
- Rainbow: flash256off :: Chunk
- Rainbow: flash8off :: Chunk
- Rainbow: flashOff :: Chunk
- Rainbow: inverse256off :: Chunk
- Rainbow: inverse8off :: Chunk
- Rainbow: inverseOff :: Chunk
- Rainbow: noColor256 :: Color256
- Rainbow: noColor8 :: Color8
- Rainbow: underline256off :: Chunk
- Rainbow: underline8off :: Chunk
- Rainbow: underlineOff :: Chunk
- Rainbow.Colors: Both :: Color8 -> Maybe Color256 -> Both
- Rainbow.Colors: both256 :: Both -> Maybe Color256
- Rainbow.Colors: both8 :: Both -> Color8
- Rainbow.Colors: data Both
- Rainbow.Colors: instance Color Both
- Rainbow.Colors: instance Eq Both
- Rainbow.Colors: instance Ord Both
- Rainbow.Colors: instance Show Both
+ Rainbow: Radiant :: Color8 -> Maybe Color256 -> Radiant
+ Rainbow: data Radiant
+ Rainbow: rad256 :: Radiant -> Maybe Color256
+ Rainbow: rad8 :: Radiant -> Color8
+ Rainbow.Colors: Radiant :: Color8 -> Maybe Color256 -> Radiant
+ Rainbow.Colors: data Radiant
+ Rainbow.Colors: instance Color Radiant
+ Rainbow.Colors: instance Eq Radiant
+ Rainbow.Colors: instance Ord Radiant
+ Rainbow.Colors: instance Show Radiant
+ Rainbow.Colors: rad256 :: Radiant -> Maybe Color256
+ Rainbow.Colors: rad8 :: Radiant -> Color8
- Rainbow: black :: Both
+ Rainbow: black :: Radiant
- Rainbow: blue :: Both
+ Rainbow: blue :: Radiant
- Rainbow: cyan :: Both
+ Rainbow: cyan :: Radiant
- Rainbow: green :: Both
+ Rainbow: green :: Radiant
- Rainbow: magenta :: Both
+ Rainbow: magenta :: Radiant
- Rainbow: red :: Both
+ Rainbow: red :: Radiant
- Rainbow: white :: Both
+ Rainbow: white :: Radiant
- Rainbow: yellow :: Both
+ Rainbow: yellow :: Radiant
- Rainbow.Colors: black :: Both
+ Rainbow.Colors: black :: Radiant
- Rainbow.Colors: blue :: Both
+ Rainbow.Colors: blue :: Radiant
- Rainbow.Colors: both :: Color8 -> Both
+ Rainbow.Colors: both :: Color8 -> Radiant
- Rainbow.Colors: cyan :: Both
+ Rainbow.Colors: cyan :: Radiant
- Rainbow.Colors: green :: Both
+ Rainbow.Colors: green :: Radiant
- Rainbow.Colors: magenta :: Both
+ Rainbow.Colors: magenta :: Radiant
- Rainbow.Colors: red :: Both
+ Rainbow.Colors: red :: Radiant
- Rainbow.Colors: white :: Both
+ Rainbow.Colors: white :: Radiant
- Rainbow.Colors: yellow :: Both
+ Rainbow.Colors: yellow :: Radiant
Files
- lib/Rainbow.hs +35/−42
- lib/Rainbow/Colors.hs +21/−19
- lib/Rainbow/Types.hs +0/−3
- rainbow.cabal +2/−2
lib/Rainbow.hs view
@@ -30,11 +30,11 @@ -- Here are some basic examples: -- -- @--- 'putChunkLn' $ "Some blue text" <> 'fore' 'blue'--- 'putChunkLn' $ "Blue on red background"--- <> 'fore' 'blue' <> 'back' 'red'--- 'putChunkLn' $ "Blue on red, foreground bold"--- <> 'fore' 'blue' <> 'back' 'red' <> 'bold'+-- 'putChunkLn' $ \"Some blue text\" \<> 'fore' 'blue'+-- 'putChunkLn' $ \"Blue on red background\"+-- \<> 'fore' 'blue' \<> 'back' 'red'+-- 'putChunkLn' $ \"Blue on red, foreground bold\"+-- \<> 'fore' 'blue' \<> 'back' 'red' \<> 'bold' -- @ -- -- But what makes Rainbow a little more interesting is that you can@@ -43,8 +43,8 @@ -- supports 256 colors (like @xterm-256color@) before you start GHCi: -- -- @--- 'putChunkLn' $ "Blue on 8-color terminal, red on 256-color terminal"--- <> 'fore' 'blue8' <> 'back' ('to256' 'red')+-- 'putChunkLn' $ \"Blue on 8-color terminal, red on 256-color terminal\"+-- \<> 'fore' 'blue8' \<> 'fore' ('to256' 'red8') -- @ -- -- To get a 'Color256', which affects only 256-color terminals, there@@ -54,15 +54,15 @@ -- -- @ -- import Data.Word ('Data.Word.Word8')--- 'putChunkLn' $ "Pink on 256-color terminal only"--- <> 'fore' (201 :: 'Data.Word.Word8')+-- 'putChunkLn' $ \"Pink on 256-color terminal only\"+-- \<> 'fore' (201 :: 'Data.Word.Word8') -- @ -- -- If 'mappend' multiple chunks that change the same property, the -- rightmost one \"wins\": -- -- @--- 'putChunkLn' $ "This will be blue" <> 'fore' 'red' <> 'fore' 'blue'+-- 'putChunkLn' $ \"This will be blue\" \<> 'fore' 'red' \<> 'fore' 'blue' -- @ -- -- This property comes in handy if you want to specify a default color@@ -70,17 +70,17 @@ -- 256-color terminal: -- -- @--- 'putChunkLn' $ "Red on 8-color, pink on 256-color"--- <> 'fore' 'red' <> 'fore' (201 :: 'Data.Word.Word8')+-- 'putChunkLn' $ \"Red on 8-color, pink on 256-color\"+-- \<> 'fore' 'red' \<> 'fore' (201 :: 'Data.Word.Word8') -- @ -- -- However, if you use 'mappend' to add additional 'Chunk's that have -- text, the text will be appended: -- -- @--- 'putChunkLn' $ 'fore' 'green' <> "You will see this text "--- <> "and this text too, but it will all be blue"--- <> 'fore' 'blue'+-- 'putChunkLn' $ 'fore' 'green' \<> \"You will see this text \"+-- \<> \"and this text too, but it will all be blue\"+-- \<> 'fore' 'blue' -- @ -- -- Although one chunk can have different colors on 8- and 256-color@@ -128,46 +128,41 @@ -- | These 'Chunk's affect both 8 and 256 color terminals: -- -- @- -- 'putChunkLn' $ "bold on 8 and 256 color terminals" <> 'bold'+ -- 'putChunkLn' $ \"bold on 8 and 256 color terminals\" \<> 'bold' -- @- --- -- There are also 'Chunk's to turn an effect off, such as- -- 'boldOff'. Ordinarily you will not need these because each chunk- -- starts with no effects, so you only need to turn on the effects- -- you want. However the @off@ 'Chunk's are here if you need them. - , bold, boldOff- , underline, underlineOff- , flash, flashOff- , inverse, inverseOff+ , bold+ , underline+ , flash+ , inverse -- * Effects for 8-color terminals only -- | These 'Chunk's affect 8-color terminals only. -- -- @- -- 'putChunkLn' $ "Bold on 8 color terminal only" <> 'bold8'+ -- 'putChunkLn' $ \"Bold on 8 color terminal only\" \<> 'bold8' -- @ - , bold8, bold8off- , underline8, underline8off- , flash8, flash8off- , inverse8, inverse8off+ , bold8+ , underline8+ , flash8+ , inverse8 -- * Effects for 256-color terminals only -- | These 'Chunk's affect 256-color terminals only. -- -- @- -- 'putChunkLn' $ "Underlined on 256-color terminal, "- -- <> "bold on 8-color terminal"- -- <> 'underline256' <> 'bold8'+ -- 'putChunkLn' $ \"Underlined on 256-color terminal, \"+ -- \<> \"bold on 8-color terminal\"+ -- \<> 'underline256' \<> 'bold8' -- @ - , bold256, bold256off- , underline256, underline256off- , flash256, flash256off- , inverse256, inverse256off+ , bold256+ , underline256+ , flash256+ , inverse256 -- * Colors @@ -175,7 +170,7 @@ , Color(..) -- ** Colors for both 8- and 256-color terminals- , Both(..)+ , Radiant(..) , black , red , green@@ -186,10 +181,9 @@ , white - -- ** Colors for 8-color terminals+ -- ** Colors for 8-color terminals only , Enum8(..) , Color8(..)- , noColor8 , black8 , red8 , green8@@ -199,9 +193,8 @@ , cyan8 , white8 - -- ** Colors for 256-color terminals+ -- ** Colors for 256-color terminals only , Color256(..)- , noColor256 , grey , brightRed , brightGreen
lib/Rainbow/Colors.hs view
@@ -75,39 +75,41 @@ -- * Both 8- and 256-color terminals --- | Things of type 'Both' affect both 8- and 256-color terminals.--- (They do /not/ affect both the foreground and background.)-data Both = Both- { both8 :: Color8- , both256 :: Maybe Color256- -- ^ If 'Nothing', use the 'both8' color on 256-color terminals.+-- | A 'Radiant' affects both 8- and 256-color terminals. (It does+-- /not/ necessarily affect both the foreground and background;+-- whether it affects the foreground, background, or both depends upon+-- the context in which it is used.)+data Radiant = Radiant+ { rad8 :: Color8+ , rad256 :: Maybe Color256+ -- ^ If 'Nothing', use the 'rad8' color on 256-color terminals. } deriving (Eq, Ord, Show) -both :: Color8 -> Both-both c8 = Both c8 Nothing+both :: Color8 -> Radiant+both c8 = Radiant c8 Nothing -black :: Both+black :: Radiant black = both black8 -red :: Both+red :: Radiant red = both red8 -green :: Both+green :: Radiant green = both green8 -yellow :: Both+yellow :: Radiant yellow = both yellow8 -blue :: Both+blue :: Radiant blue = both blue8 -magenta :: Both+magenta :: Radiant magenta = both magenta8 -cyan :: Both+cyan :: Radiant cyan = both cyan8 -white :: Both+white :: Radiant white = both white8 -- | Changing colors. Instances of this class affect the background@@ -161,10 +163,10 @@ -- | Affects the foreground and background of both 8- and 256-color -- terminals.-instance Color Both where- fore (Both c8 mc256) = fore c8+instance Color Radiant where+ fore (Radiant c8 mc256) = fore c8 <> fore (fromMaybe (to256 c8) mc256)- back (Both c8 mc256) = back c8+ back (Radiant c8 mc256) = back c8 <> back (fromMaybe (to256 c8) mc256) -- | Affects the foreground and background of 8-color terminals.
lib/Rainbow/Types.hs view
@@ -48,9 +48,6 @@ -- | Gets the terminal definition from the environment and a handle. -- If the handle is not a terminal, 'Dumb' is returned. Otherwise, -- the terminal is obtained from the environment.------ /Changed in version 0.12.0.0/ - the type of this function was--- different in previous versions. smartTermFromEnv :: IO.Handle -- ^ Check this handle to see if it is a terminal (typically you
rainbow.cabal view
@@ -3,10 +3,10 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2014-10-27 11:08:35.892513 EDT+-- Generated on: 2014-11-22 16:50:57.649392 EST -- Cartel library version: 0.10.0.2 name: rainbow-version: 0.18.0.0+version: 0.20.0.0 cabal-version: >= 1.14 build-type: Simple license: BSD3