packages feed

fmt-terminal-colors (empty) → 0.1.0.0

raw patch · 7 files changed

+116/−0 lines, 7 filesdep +ansi-terminaldep +basedep +fmtsetup-changed

Dependencies added: ansi-terminal, base, fmt, fmt-terminal-colors

Files

+ ChangeLog.md view
@@ -0,0 +1,3 @@+# Changelog for fmt-terminal-colors++## Unreleased changes
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright Kamil Figiela (c) 2018++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Author name here nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,1 @@+# fmt-terminal-colors
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ fmt-terminal-colors.cabal view
@@ -0,0 +1,55 @@+-- This file has been generated from package.yaml by hpack version 0.28.2.+--+-- see: https://github.com/sol/hpack+--+-- hash: 6ca1d6265e15072bd60cf9dcd355667b3c9941e533f9db24da4a5fb4a9e190b8++name:           fmt-terminal-colors+version:        0.1.0.0+synopsis:       ANSI terminal colors formatters for fmt library+description:    Please see the README on GitHub at <https://github.com/kfigiela/fmt-terminal-colors#readme>+category:       Text+homepage:       https://github.com/kfigiela/fmt-terminal-colors#readme+bug-reports:    https://github.com/kfigiela/fmt-terminal-colors/issues+author:         Kamil Figiela+maintainer:     kamil.figiela@gmail.com+copyright:      2018 Kamil Figiela+license:        BSD3+license-file:   LICENSE+build-type:     Simple+cabal-version:  >= 1.10+extra-source-files:+    ChangeLog.md+    README.md++source-repository head+  type: git+  location: https://github.com/kfigiela/fmt-terminal-colors++library+  exposed-modules:+      Fmt.Terminal+  other-modules:+      Paths_fmt_terminal_colors+  hs-source-dirs:+      src+  build-depends:+      ansi-terminal+    , base >=4.7 && <5+    , fmt+  default-language: Haskell2010++test-suite fmt-terminal-colors-test+  type: exitcode-stdio-1.0+  main-is: Spec.hs+  other-modules:+      Paths_fmt_terminal_colors+  hs-source-dirs:+      test+  ghc-options: -threaded -rtsopts -with-rtsopts=-N+  build-depends:+      ansi-terminal+    , base >=4.7 && <5+    , fmt+    , fmt-terminal-colors+  default-language: Haskell2010
+ src/Fmt/Terminal.hs view
@@ -0,0 +1,23 @@+module Fmt.Terminal+    ( colorF+    , colorVividF+    , module ANSIColors+    ) where++import           Fmt                       (Buildable, Builder, build)+import qualified System.Console.ANSI       as ANSI+import           System.Console.ANSI.Types as ANSIColors (Color (..))++-- | Wrap content with escape sequence to set and reset color of normal intensity.+colorF :: Buildable a => ANSI.Color -> a -> Builder+colorF = colorF' ANSI.Dull++-- | The same as `colorF` but uses vivid intensity.+colorVividF :: Buildable a => ANSI.Color -> a -> Builder+colorVividF = colorF' ANSI.Vivid++colorF' :: Buildable a => ANSI.ColorIntensity -> ANSI.Color -> a -> Builder+colorF' intensity color content+   = (build $ ANSI.setSGRCode [ANSI.SetColor ANSI.Foreground intensity color])+  <> (build content)+  <> (build $ ANSI.setSGRCode [ANSI.Reset])
+ test/Spec.hs view
@@ -0,0 +1,2 @@+main :: IO ()+main = putStrLn "Test suite not yet implemented"