1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 02:54:51 +09:00

Define colors for use with 'diagrams'

This commit is contained in:
fr33domlover 2016-06-26 08:03:18 +00:00
parent 386d499a61
commit a4eeb61a44
2 changed files with 76 additions and 0 deletions

73
src/Vervis/Colour.hs Normal file
View file

@ -0,0 +1,73 @@
{- This file is part of Vervis.
-
- Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
-
- 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
- <http://creativecommons.org/publicdomain/zero/1.0/>.
-}
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

View file

@ -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