packages feed

safe-coloured-text-terminfo 0.2.0.0 → 0.3.0.0

raw patch · 2 files changed

+21/−16 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

safe-coloured-text-terminfo.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack  name:           safe-coloured-text-terminfo-version:        0.2.0.0+version:        0.3.0.0 synopsis:       Safely output coloured text category:       User Interfaces homepage:       https://github.com/NorfairKing/safe-coloured-text#readme
src/Text/Colour/Capabilities/FromEnv.hs view
@@ -18,20 +18,25 @@   case mTerm of     Nothing -> pure WithoutColours     Just term -> do-      -- To support 24-bit colour:-      -- https://unix.stackexchange.com/questions/450365/check-if-terminal-supports-24-bit-true-color-      mct <- lookupEnv "COLORTERM"-      pure $ case mct of-        Just "truecolor" -> With24BitColours-        Just "24bit" -> With24BitColours-        _ ->-          case Terminfo.getCapability term (Terminfo.tiGetNum "colors") of-            Nothing -> WithoutColours-            Just c-              | c > 256 -> With24BitColours-              | c >= 256 -> With8BitColours-              | c >= 8 -> With8Colours-              | otherwise -> WithoutColours+      -- To support https://no-color.org/+      mnc <- lookupEnv "NO_COLOR"+      case mnc of+        Just _ -> pure WithoutColours+        Nothing -> do+          -- To support 24-bit colour:+          -- https://unix.stackexchange.com/questions/450365/check-if-terminal-supports-24-bit-true-color+          mct <- lookupEnv "COLORTERM"+          pure $ case mct of+            Just "truecolor" -> With24BitColours+            Just "24bit" -> With24BitColours+            _ ->+              case Terminfo.getCapability term (Terminfo.tiGetNum "colors") of+                Nothing -> WithoutColours+                Just c+                  | c > 256 -> With24BitColours+                  | c >= 256 -> With8BitColours+                  | c >= 8 -> With8Colours+                  | otherwise -> WithoutColours  -- | Try to detect how many colours a given handle can handle. --