packages feed

rainbow 0.24.0.0 → 0.26.0.0

raw patch · 5 files changed

+89/−20 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Rainbow.Types: instance Selector S1_0_2Chunk
+ Rainbow.Types: Scheme :: Style Enum8 -> Style Word8 -> Scheme
+ Rainbow.Types: _scheme :: Chunk a -> Scheme
+ Rainbow.Types: black :: Enum8
+ Rainbow.Types: blue :: Enum8
+ Rainbow.Types: brightBlue :: Word8
+ Rainbow.Types: brightCyan :: Word8
+ Rainbow.Types: brightGreen :: Word8
+ Rainbow.Types: brightMagenta :: Word8
+ Rainbow.Types: brightRed :: Word8
+ Rainbow.Types: brightWhite :: Word8
+ Rainbow.Types: brightYellow :: Word8
+ Rainbow.Types: cyan :: Enum8
+ Rainbow.Types: data Scheme
+ Rainbow.Types: green :: Enum8
+ Rainbow.Types: grey :: Word8
+ Rainbow.Types: instance Constructor C1_0Scheme
+ Rainbow.Types: instance Datatype D1Scheme
+ Rainbow.Types: instance Eq Scheme
+ Rainbow.Types: instance Generic Scheme
+ Rainbow.Types: instance Monoid Scheme
+ Rainbow.Types: instance Ord Scheme
+ Rainbow.Types: instance Selector S1_0_0Scheme
+ Rainbow.Types: instance Selector S1_0_1Scheme
+ Rainbow.Types: instance Show Scheme
+ Rainbow.Types: instance Typeable Scheme
+ Rainbow.Types: magenta :: Enum8
+ Rainbow.Types: red :: Enum8
+ Rainbow.Types: scheme :: Lens' (Chunk a_aazi) Scheme
+ Rainbow.Types: white :: Enum8
+ Rainbow.Types: yellow :: Enum8
- Rainbow.Types: Chunk :: Style Enum8 -> Style Word8 -> a -> Chunk a
+ Rainbow.Types: Chunk :: Scheme -> a -> Chunk a
- Rainbow.Types: _style256 :: Chunk a -> Style Word8
+ Rainbow.Types: _style256 :: Scheme -> Style Word8
- Rainbow.Types: _style8 :: Chunk a -> Style Enum8
+ Rainbow.Types: _style8 :: Scheme -> Style Enum8
- Rainbow.Types: back :: Lens' (Style a_aa0A) (Color a_aa0A)
+ Rainbow.Types: back :: Lens' (Style a_aa1m) (Color a_aa1m)
- Rainbow.Types: fore :: Lens' (Style a_aa0A) (Color a_aa0A)
+ Rainbow.Types: fore :: Lens' (Style a_aa1m) (Color a_aa1m)
- Rainbow.Types: format :: Lens' (Style a_aa0A) Format
+ Rainbow.Types: format :: Lens' (Style a_aa1m) Format
- Rainbow.Types: style256 :: Lens' (Chunk a_aarp) (Style Word8)
+ Rainbow.Types: style256 :: Lens' Scheme (Style Word8)
- Rainbow.Types: style8 :: Lens' (Chunk a_aarp) (Style Enum8)
+ Rainbow.Types: style8 :: Lens' Scheme (Style Enum8)
- Rainbow.Types: yarn :: Lens (Chunk a_aarp) (Chunk a_aaEo) a_aarp a_aaEo
+ Rainbow.Types: yarn :: Lens (Chunk a_aazi) (Chunk a_aaJd) a_aazi a_aaJd

Files

lib/Rainbow.hs view
@@ -173,8 +173,8 @@ import Data.Monoid (Monoid(mempty), (<>))  formatBoth :: Setter' Y.Format Bool -> Y.Chunk a -> Y.Chunk a-formatBoth get c = c & Y.style8 . Y.format . get .~ True-  & Y.style256 . Y.format . get .~ True+formatBoth get c = c & Y.scheme . Y.style8 . Y.format . get .~ True+  & Y.scheme . Y.style256 . Y.format . get .~ True  -- | Bold. What actually happens when you use Bold is going to depend -- on your terminal. For example, xterm allows you actually use a bold@@ -211,13 +211,13 @@  -- | Change the foreground color for both 8- and 256-color terminals. fore :: Y.Radiant -> Y.Chunk a -> Y.Chunk a-fore (Y.Radiant c8 c256) c = c & Y.style8 . Y.fore .~ c8-  & Y.style256 . Y.fore .~ c256+fore (Y.Radiant c8 c256) c = c & Y.scheme . Y.style8 . Y.fore .~ c8+  & Y.scheme . Y.style256 . Y.fore .~ c256  -- | Change the background color for both 8- and 256-color terminals. back :: Y.Radiant -> Y.Chunk a -> Y.Chunk a-back (Y.Radiant c8 c256) c = c & Y.style8 . Y.back .~ c8-  & Y.style256 . Y.back .~ c256+back (Y.Radiant c8 c256) c = c & Y.scheme . Y.style8 . Y.back .~ c8+  & Y.scheme . Y.style256 . Y.back .~ c256  -- | Ensures that a 'Y.Radiant' affects only a 256-color terminal. -- For instance, to make text that is blue on an 8-color terminal but
lib/Rainbow/Translate.hs view
@@ -221,14 +221,14 @@   => T.Chunk a   -> [ByteString]   -> [ByteString]-toByteStringsColors0 (T.Chunk _ _ yn) = render yn+toByteStringsColors0 (T.Chunk _ yn) = render yn  toByteStringsColors8   :: Renderable a   => T.Chunk a   -> [ByteString]   -> [ByteString]-toByteStringsColors8 (T.Chunk s8 _ yn)+toByteStringsColors8 (T.Chunk (T.Scheme s8 _) yn)   = normalDefault   . renderStyle8 s8   . render yn@@ -239,7 +239,7 @@   => T.Chunk a   -> [ByteString]   -> [ByteString]-toByteStringsColors256 (T.Chunk _ s256 yn)+toByteStringsColors256 (T.Chunk (T.Scheme _ s256) yn)   = normalDefault   . renderStyle256 s256   . render yn
lib/Rainbow/Types.hs view
@@ -65,6 +65,54 @@   E6 -> 6   E7 -> 7 +black :: Enum8+black = E0++red :: Enum8+red = E1++green :: Enum8+green = E2++yellow :: Enum8+yellow = E3++blue :: Enum8+blue = E4++magenta :: Enum8+magenta = E5++cyan :: Enum8+cyan = E6++white :: Enum8+white = E7++grey :: Word8+grey = 8++brightRed :: Word8+brightRed = 9++brightGreen :: Word8+brightGreen = 10++brightYellow :: Word8+brightYellow = 11++brightBlue :: Word8+brightBlue = 12++brightMagenta :: Word8+brightMagenta = 13++brightCyan :: Word8+brightCyan = 14++brightWhite :: Word8+brightWhite = 15+ -- -- Styles --@@ -111,6 +159,22 @@     = Style (x0 <> y0) (x1 <> y1) (x2 <> y2)  --+-- Scheme+--++-- | Holds the 'Style' for both 8- and 256-color terminals.+data Scheme = Scheme+  { _style8 :: Style Enum8+  , _style256 :: Style Word8+  } deriving (Eq, Ord, Show, Generic, Typeable)++makeLenses ''Scheme++instance Monoid Scheme where+  mempty = Scheme mempty mempty+  mappend (Scheme x0 x1) (Scheme y0 y1) = Scheme (x0 <> y0) (x1 <> y1)++-- -- Chunks -- @@ -121,8 +185,7 @@ -- a 256 color terminal.  data Chunk a = Chunk-  { _style8 :: Style Enum8-  , _style256 :: Style Word8+  { _scheme :: Scheme   , _yarn :: a   } deriving (Eq, Show, Ord, Generic, Typeable, Functor,               Foldable, Traversable)@@ -133,13 +196,13 @@ -- not there is any text depends on the 'mempty' for the type of the -- '_yarn'. instance Monoid a => Monoid (Chunk a) where-  mempty = Chunk mempty mempty mempty-  mappend (Chunk x0 x1 x2) (Chunk y0 y1 y2)-    = Chunk (x0 <> y0) (x1 <> y1) (x2 <> y2)+  mempty = Chunk mempty mempty+  mappend (Chunk x0 x1) (Chunk y0 y1)+    = Chunk (x0 <> y0) (x1 <> y1)  -- | Creates a 'Chunk' with no formatting and with the given text. chunk :: a -> Chunk a-chunk = Chunk mempty mempty+chunk = Chunk mempty  makeLenses ''Chunk 
rainbow.cabal view
@@ -3,11 +3,11 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2015-04-25 16:26:22.924321 EDT+-- Generated on: 2015-04-26 13:24:27.048354 EDT -- Cartel library version: 0.14.2.6  name: rainbow-version: 0.24.0.0+version: 0.26.0.0 cabal-version: >= 1.18 license: BSD3 license-file: LICENSE
tests/Rainbow/QuickCheck.hs view
@@ -70,16 +70,22 @@     . coarbitrary b     . coarbitrary c +instance Arbitrary Scheme where+  arbitrary = Scheme <$> arbitrary <*> arbitrary+  shrink = genericShrink +instance CoArbitrary Scheme where+  coarbitrary (Scheme a b) = coarbitrary a . coarbitrary b++ instance Arbitrary a => Arbitrary (Chunk a) where-  arbitrary = Chunk <$> arbitrary <*> arbitrary <*> arbitrary+  arbitrary = Chunk <$> arbitrary <*> arbitrary   shrink = genericShrink  instance CoArbitrary a => CoArbitrary (Chunk a) where-  coarbitrary (Chunk a b c)+  coarbitrary (Chunk a b)     = coarbitrary a     . coarbitrary b-    . coarbitrary c  instance Arbitrary Radiant where   arbitrary = Radiant <$> arbitrary <*> arbitrary