rainbox 0.6.0.2 → 0.8.0.0
raw patch · 7 files changed
+48/−42 lines, 7 filesdep ~rainbowdep ~rainbow-testsdep ~randomPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: rainbow, rainbow-tests, random, tasty, text
API changes (from Hackage documentation)
- Rainbox: boxBackground256 :: Background -> Color256
- Rainbox: boxBackground8 :: Background -> Color8
- Rainbox: data Background
- Rainbox: same :: Color8 -> Background
- Rainbox.Box: boxBackground256 :: Background -> Color256
- Rainbox.Box: boxBackground8 :: Background -> Color8
- Rainbox.Box: data Background
- Rainbox.Box: same :: Color8 -> Background
- Rainbox.Box.Primitives: boxBackground256 :: Background -> Color256
- Rainbox.Box.Primitives: boxBackground8 :: Background -> Color8
- Rainbox.Box.Primitives: data Background
- Rainbox.Reader: boxBackground256 :: Background -> Color256
- Rainbox.Reader: boxBackground8 :: Background -> Color8
- Rainbox.Reader: data Background
- Rainbox.Reader: same :: Color8 -> Background
+ Rainbox: data Box
+ Rainbox: newtype Background
+ Rainbox.Box: newtype Background
+ Rainbox.Box.Primitives: instance Color Background
+ Rainbox.Box.Primitives: instance Ord Background
+ Rainbox.Box.Primitives: newtype Background
+ Rainbox.Reader: newtype Background
- Rainbox: Background :: Color8 -> Color256 -> Background
+ Rainbox: Background :: Radiant -> Background
- Rainbox.Box: Background :: Color8 -> Color256 -> Background
+ Rainbox.Box: Background :: Radiant -> Background
- Rainbox.Box.Primitives: Background :: Color8 -> Color256 -> Background
+ Rainbox.Box.Primitives: Background :: Radiant -> Background
- Rainbox.Reader: Background :: Color8 -> Color256 -> Background
+ Rainbox.Reader: Background :: Radiant -> Background
Files
- lib/Rainbox.hs +2/−2
- lib/Rainbox/Box.hs +17/−12
- lib/Rainbox/Box/Primitives.hs +7/−5
- lib/Rainbox/Reader.hs +0/−1
- rainbox.cabal +18/−18
- test/Rainbox/Box/PrimitivesTests.hs +1/−1
- test/Visual.hs +3/−3
lib/Rainbox.hs view
@@ -20,7 +20,6 @@ Background(..) , defaultBackground , backgroundFromChunk- , same -- * Alignment , Align@@ -35,8 +34,9 @@ -- * Bar , Bar(..) - -- * Cell+ -- * Cell and Box , Cell(..)+ , Box -- * Creating Box and gluing them together
lib/Rainbox/Box.hs view
@@ -36,7 +36,6 @@ , defaultBackground , backgroundFromChunk , backgroundToTextSpec- , same -- * Height and columns , Height(..)@@ -102,6 +101,7 @@ import qualified Data.Text as X import Rainbow import Rainbow.Types+import Rainbow.Colors import qualified Rainbox.Box.Primitives as B import Rainbox.Box.Primitives ( Box@@ -116,7 +116,8 @@ import qualified System.IO as IO backgroundFromChunk :: Chunk -> B.Background-backgroundFromChunk (Chunk ts _) = B.Background bk8 bk256+backgroundFromChunk (Chunk ts _) =+ B.Background $ Radiant bk8 (Just bk256) where bk8 = case getLast . background8 . style8 $ ts of Nothing -> noColor8@@ -126,17 +127,21 @@ Just c -> c backgroundToTextSpec :: B.Background -> TextSpec-backgroundToTextSpec (B.Background bk8 bk256) = TextSpec- { style8 = mempty { background8 = Last . Just $ bk8 }- , style256 = mempty { background256 = Last . Just $ bk256 } }+backgroundToTextSpec (B.Background (Radiant c8 may256)) = TextSpec s8 s256+ where+ s8 = Style8 f8 b8 sc+ s256 = Style256 f256 b256 sc+ f8 = Last Nothing+ f256 = Last Nothing+ b8 = Last (Just c8)+ b256 = case may256 of+ Nothing -> Last (Just (to256 c8))+ Just c256 -> Last (Just c256)+ sc = mempty -- | Use the default background colors of the current terminal. defaultBackground :: B.Background-defaultBackground = B.Background noColor8 noColor256---- | Use the same color for 8 and 256-color backgrounds.-same :: Color8 -> B.Background-same c = B.Background c (to256 c)+defaultBackground = B.Background $ Radiant noColor8 Nothing -- -- # Box making@@ -327,8 +332,8 @@ where toChunk = either spcToChunk id . B.unNibble spcToChunk ss =- Chunk (backgroundToTextSpec (B.spcBackground ss))- [X.replicate (B.numSpaces ss) (X.singleton ' ')]+ fromText (X.replicate (B.numSpaces ss) (X.singleton ' '))+ <> back (B.spcBackground ss) -- | Prints a Box to standard output. If standard output is not a -- terminal, no colors are used. Otherwise, colors are used if your
lib/Rainbox/Box/Primitives.hs view
@@ -80,11 +80,13 @@ -- # Background -- | Background colors to use when inserting necessary padding.-data Background = Background- { boxBackground8 :: Color8- , boxBackground256 :: Color256- } deriving (Eq, Show)+newtype Background = Background Radiant+ deriving (Eq, Ord, Show) +instance Color Background where+ back (Background b) = back b+ fore (Background b) = fore b+ -- # Box data Spaces = Spaces@@ -104,7 +106,7 @@ instance HasWidth Nibble where width = either width width . unNibble --- | Occupies a single row on screen. The 'Chunk' you place in a+-- | Occupies a single row on screen. The 'Chunk's you place in a -- 'Bar' should not have any control characters such as newlines or -- tabs, as rainbox assumes that each character in a 'Bar' takes up -- one screen column and that each character does not create
lib/Rainbox/Reader.hs view
@@ -9,7 +9,6 @@ ( -- * Backgrounds B.Background(..) , R.defaultBackground- , R.same -- * Box properties , B.Bar(..)
rainbox.cabal view
@@ -3,10 +3,10 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2014-10-27 12:02:48.640249 EDT+-- Generated on: 2014-11-23 09:17:19.169553 EST -- Cartel library version: 0.10.0.2 name: rainbox-version: 0.6.0.2+version: 0.8.0.0 cabal-version: >= 1.14 build-type: Simple license: BSD3@@ -58,8 +58,8 @@ lib build-depends: base ((> 4.5.0.0 || == 4.5.0.0) && < 4.8.0.0)- , rainbow ((> 0.18 || == 0.18) && < 0.19)- , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.2.0.0)+ , rainbow ((> 0.20 || == 0.20) && < 0.21)+ , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.3.0.0) , transformers ((> 0.3.0.0 || == 0.3.0.0) && < 0.5.0.0) , array ((> 0.4.0.0 || == 0.4.0.0) && < 0.6.0.0) @@ -89,16 +89,16 @@ default-language: Haskell2010 build-depends: base ((> 4.5.0.0 || == 4.5.0.0) && < 4.8.0.0)- , rainbow ((> 0.18 || == 0.18) && < 0.19)- , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.2.0.0)+ , rainbow ((> 0.20 || == 0.20) && < 0.21)+ , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.3.0.0) , transformers ((> 0.3.0.0 || == 0.3.0.0) && < 0.5.0.0) , array ((> 0.4.0.0 || == 0.4.0.0) && < 0.6.0.0) build-depends:- tasty ((> 0.8 || == 0.8) && < 0.9)+ tasty ((> 0.10.1 || == 0.10.1) && < 0.11) , tasty-quickcheck ((> 0.8.1 || == 0.8.1) && < 0.9) , QuickCheck ((> 2.7.5 || == 2.7.5) && < 2.8)- , random ((> 1.0.0.0 || == 1.0.0.0) && < 1.1)- , rainbow-tests ((> 0.18 || == 0.18) && < 0.19)+ , random ((> 1.0.0.0 || == 1.0.0.0) && < 1.2)+ , rainbow-tests ((> 0.20 || == 0.20) && < 0.21) else buildable: False @@ -112,16 +112,16 @@ default-language: Haskell2010 build-depends: base ((> 4.5.0.0 || == 4.5.0.0) && < 4.8.0.0)- , rainbow ((> 0.18 || == 0.18) && < 0.19)- , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.2.0.0)+ , rainbow ((> 0.20 || == 0.20) && < 0.21)+ , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.3.0.0) , transformers ((> 0.3.0.0 || == 0.3.0.0) && < 0.5.0.0) , array ((> 0.4.0.0 || == 0.4.0.0) && < 0.6.0.0) main-is: rainbox-test.hs build-depends:- tasty ((> 0.8 || == 0.8) && < 0.9)+ tasty ((> 0.10.1 || == 0.10.1) && < 0.11) , tasty-quickcheck ((> 0.8.1 || == 0.8.1) && < 0.9) , QuickCheck ((> 2.7.5 || == 2.7.5) && < 2.8)- , rainbow-tests ((> 0.18 || == 0.18) && < 0.19)+ , rainbow-tests ((> 0.20 || == 0.20) && < 0.21) Test-Suite rainbox-visual type: exitcode-stdio-1.0@@ -149,13 +149,13 @@ default-language: Haskell2010 build-depends: base ((> 4.5.0.0 || == 4.5.0.0) && < 4.8.0.0)- , rainbow ((> 0.18 || == 0.18) && < 0.19)- , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.2.0.0)+ , rainbow ((> 0.20 || == 0.20) && < 0.21)+ , text ((> 0.11.3.1 || == 0.11.3.1) && < 1.3.0.0) , transformers ((> 0.3.0.0 || == 0.3.0.0) && < 0.5.0.0) , array ((> 0.4.0.0 || == 0.4.0.0) && < 0.6.0.0) build-depends:- tasty ((> 0.8 || == 0.8) && < 0.9)+ tasty ((> 0.10.1 || == 0.10.1) && < 0.11) , tasty-quickcheck ((> 0.8.1 || == 0.8.1) && < 0.9) , QuickCheck ((> 2.7.5 || == 2.7.5) && < 2.8)- , random ((> 1.0.0.0 || == 1.0.0.0) && < 1.1)- , rainbow-tests ((> 0.18 || == 0.18) && < 0.19)+ , random ((> 1.0.0.0 || == 1.0.0.0) && < 1.2)+ , rainbow-tests ((> 0.20 || == 0.20) && < 0.21)
test/Rainbox/Box/PrimitivesTests.hs view
@@ -32,7 +32,7 @@ neg = fmap (negate . abs) arbitrarySizedIntegral genBackground :: Gen Background-genBackground = liftM2 Background G.color8 G.color256+genBackground = fmap Background G.radiant -- | Generates blank Box. genBlankBox :: Gen Box
test/Visual.hs view
@@ -20,9 +20,9 @@ wide = "a wide box, see how wide I am?" <> colors -greenBack = same green8+greenBack = Background (Radiant green8 Nothing) -yellowBack = same yellow8+yellowBack = Background (Radiant yellow8 Nothing) all3 = [narrow, midwidth, wide] @@ -123,7 +123,7 @@ testVert "punctuateH" (\bk av bxs -> punctuateH bk av " " bxs) testHoriz "punctuateV" (\bk ah bxs -> punctuateV bk ah " " bxs) - let grn = same green8+ let grn = Background (Radiant green8 Nothing) testHoriz "column" (\bk ah bxs -> catV defaultBackground left (column bk ah bxs))