tamarin-prover-utils-1.2.2: Utility library for the tamarin prover.

Copyright | (c) 2010 Simon Meier
License | GPL v3 (see LICENSE)
Maintainer | Simon Meier <iridcode@gmail.com>
Safe Haskell | Safe
Language | Haskell98

Data.Color

Contents

- Datatypes
  - Predefined colors
  - Conversions
- Color Palettes

Description

A simple color module for handling RGB and HSV representations of colors.

Synopsis

- data RGB a = RGB {
  - rgbR :: !a
  - rgbG :: !a
  - rgbB :: !a
  }
- data HSV a = HSV {
  - hsvH :: !a
  - hsvS :: !a
  - hsvV :: !a
  }
- rgbToHex :: RealFrac t => RGB t -> String
- hsvToHex :: RealFrac t => HSV t -> [Char]
- red :: Fractional t => RGB t
- green :: Fractional t => RGB t
- blue :: Fractional t => RGB t
- rgbToGray :: Ord t => RGB t -> t
- hsvToGray :: Num t => HSV t -> HSV t
- rgbToHSV :: (Fractional t, Ord t) => RGB t -> HSV t
- hsvToRGB :: RealFrac t => HSV t -> RGB t
- colorGroups :: Double -> [Int] -> [((Int, Int), HSV Double)]
- lightColorGroups :: Double -> [Int] -> [((Int, Int), HSV Double)]

# Datatypes

data RGB a #

Constructors

RGB |
Fields rgbR :: !a rgbG :: !a rgbB :: !a

Instances

Functor RGB # |
Methods fmap :: (a -> b) -> RGB a -> RGB b # (<$) :: a -> RGB b -> RGB a #
Eq a => Eq (RGB a) # |
Methods (==) :: RGB a -> RGB a -> Bool # (/=) :: RGB a -> RGB a -> Bool #
Ord a => Ord (RGB a) # |
Methods compare :: RGB a -> RGB a -> Ordering # (<) :: RGB a -> RGB a -> Bool # (<=) :: RGB a -> RGB a -> Bool # (>) :: RGB a -> RGB a -> Bool # (>=) :: RGB a -> RGB a -> Bool # max :: RGB a -> RGB a -> RGB a # min :: RGB a -> RGB a -> RGB a #
Show a => Show (RGB a) # |
Methods showsPrec :: Int -> RGB a -> ShowS # show :: RGB a -> String # showList :: [RGB a] -> ShowS #

data HSV a #

Constructors

HSV |
Fields hsvH :: !a hsvS :: !a hsvV :: !a

Instances

Functor HSV # |
Methods fmap :: (a -> b) -> HSV a -> HSV b # (<$) :: a -> HSV b -> HSV a #
Eq a => Eq (HSV a) # |
Methods (==) :: HSV a -> HSV a -> Bool # (/=) :: HSV a -> HSV a -> Bool #
Ord a => Ord (HSV a) # |
Methods compare :: HSV a -> HSV a -> Ordering # (<) :: HSV a -> HSV a -> Bool # (<=) :: HSV a -> HSV a -> Bool # (>) :: HSV a -> HSV a -> Bool # (>=) :: HSV a -> HSV a -> Bool # max :: HSV a -> HSV a -> HSV a # min :: HSV a -> HSV a -> HSV a #
Show a => Show (HSV a) # |
Methods showsPrec :: Int -> HSV a -> ShowS # show :: HSV a -> String # showList :: [HSV a] -> ShowS #

rgbToHex :: RealFrac t => RGB t -> String #

Hexadecimal representation of an RGB value

hsvToHex :: RealFrac t => HSV t -> [Char] #

Hexadecimal representation of an HSV value; i.e., of its corresponding RGB value.

## Predefined colors

red :: Fractional t => RGB t #

green :: Fractional t => RGB t #

blue :: Fractional t => RGB t #

## Conversions

rgbToGray :: Ord t => RGB t -> t #

hsvToGray :: Num t => HSV t -> HSV t #

rgbToHSV :: (Fractional t, Ord t) => RGB t -> HSV t #

RGB to HSV conversion. Pre: 0 <= r,g,b <= 1 (Source: http://de.wikipedia.org/wiki/HSV-Farbraum)

hsvToRGB :: RealFrac t => HSV t -> RGB t #

HSV to RGB conversion. Pre: 0 <= h <= 360 and 0 <= s,v <= 1 (Source: http://de.wikipedia.org/wiki/HSV-Farbraum)

# Color Palettes

colorGroups :: Double -> [Int] -> [((Int, Int), HSV Double)] #

Build color groups according to the list of group sizes using the default `colorGroupStyle` for the function `genColorGroups`.

lightColorGroups :: Double -> [Int] -> [((Int, Int), HSV Double)] #

Build color groups according to the list of group sizes using the default light `lightColorGroupStyle` for the function `genColorGroups`.