From a4eeb61a449b4ced06d68447e877a12dd0bf6eab Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Sun, 26 Jun 2016 08:03:18 +0000 Subject: [PATCH] Define colors for use with 'diagrams' --- src/Vervis/Colour.hs | 73 ++++++++++++++++++++++++++++++++++++++++++++ vervis.cabal | 3 ++ 2 files changed, 76 insertions(+) create mode 100644 src/Vervis/Colour.hs diff --git a/src/Vervis/Colour.hs b/src/Vervis/Colour.hs new file mode 100644 index 0000000..0b58404 --- /dev/null +++ b/src/Vervis/Colour.hs @@ -0,0 +1,73 @@ +{- This file is part of Vervis. + - + - Written in 2016 by fr33domlover . + - + - ♡ Copying is an act of love. Please copy, reuse and share. + - + - The author(s) have dedicated all copyright and related and neighboring + - rights to this software to the public domain worldwide. This software is + - distributed without any warranty. + - + - You should have received a copy of the CC0 Public Domain Dedication along + - with this software. If not, see + - . + -} + +module Vervis.Colour + ( black + , white + , plain + , darkRed + , darkGreen + , darkYellow + , darkBlue + , darkMagenta + , darkCyan + , darkGray + , lightRed + , lightGreen + , lightYellow + , lightBlue + , lightMagenta + , lightCyan + , lightGray + ) +where + +import Prelude + +import Data.Colour.SRGB (Colour, sRGB24) +import Data.Word (Word8) + +import qualified Vervis.Palette as P + +uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d +uncurry3 f (x, y, z) = f x y z + +c :: (Floating a, Ord a) => (Word8, Word8, Word8) -> Colour a +c = uncurry3 sRGB24 + +black, white, plain :: (Floating a, Ord a) => Colour a +black = c P.black +white = c P.white +plain = c P.plain + +darkRed, darkGreen, darkYellow, darkBlue, darkMagenta, darkCyan, darkGray + :: (Floating a, Ord a) => Colour a +darkRed = c P.darkRed +darkGreen = c P.darkGreen +darkYellow = c P.darkYellow +darkBlue = c P.darkBlue +darkMagenta = c P.darkMagenta +darkCyan = c P.darkCyan +darkGray = c P.darkGray + +lightRed, lightGreen, lightYellow, lightBlue :: (Floating a, Ord a) => Colour a +lightMagenta, lightCyan, lightGray :: (Floating a, Ord a) => Colour a +lightRed = c P.lightRed +lightGreen = c P.lightGreen +lightYellow = c P.lightYellow +lightBlue = c P.lightBlue +lightMagenta = c P.lightMagenta +lightCyan = c P.lightCyan +lightGray = c P.lightGray diff --git a/vervis.cabal b/vervis.cabal index c7f984b..9fa7c3a 100644 --- a/vervis.cabal +++ b/vervis.cabal @@ -85,6 +85,7 @@ library Vervis.Avatar Vervis.BinaryBody Vervis.Changes + Vervis.Colour Vervis.Content Vervis.Darcs Vervis.Discussion @@ -186,6 +187,8 @@ library , case-insensitive , classy-prelude , classy-prelude-conduit + -- for defining colors for use with diagrams + , colour , conduit , containers -- for SHA1 hashing when parsing Darcs patch metadata