graphviz-2999.20.2.1: Bindings to Graphviz for graph visualisation.

Copyright | (c) Ivan Lazar Miljenovic
License | 3-Clause BSD-style
Maintainer | Ivan.Miljenovic@gmail.com
Safe Haskell | None
Language | Haskell2010

Data.GraphViz.Attributes.Colors

Contents

- Color schemes.
- Colors
- Conversion to/from `Colour`.

Description

This module defines the various colors, etc. for Graphviz. For information on colors in general, see: http://graphviz.org/doc/info/attrs.html#k:color For named colors, see: http://graphviz.org/doc/info/colors.html

Note that the ColorBrewer Color Schemes (shortened to just "Brewer" for the rest of this module) are covered by the following license (also available in the LICENSE file of this library): http://graphviz.org/doc/info/colors.html#brewer_license

Synopsis

- data ColorScheme
  - = X11
  - | SVG
  - | Brewer BrewerScheme
- data Color
  - = RGB {
    - red :: Word8
    - green :: Word8
    - blue :: Word8
    }
  - | RGBA {
    - red :: Word8
    - green :: Word8
    - blue :: Word8
    - alpha :: Word8
    }
  - | HSV {
    - hue :: Double
    - saturation :: Double
    - value :: Double
    }
  - | X11Color X11Color
  - | SVGColor SVGColor
  - | BrewerColor BrewerColor
- type ColorList = [WeightedColor]
- data WeightedColor = WC {
  - wColor :: Color
  - weighting :: Maybe Double
  }
- toWC :: Color -> WeightedColor
- toColorList :: [Color] -> ColorList
- class NamedColor nc where
  - toColor :: nc -> Color
- toWColor :: NamedColor nc => nc -> WeightedColor
- toColour :: Color -> Maybe (AlphaColour Double)
- fromColour :: Colour Double -> Color
- fromAColour :: AlphaColour Double -> Color

# Color schemes.

data ColorScheme Source #

This represents the color schemes that Graphviz accepts.

Constructors

X11 |
SVG |
Brewer BrewerScheme |

#### Instances

Instances details

Read ColorScheme Source # |
Instance details Defined in Data.GraphViz.Attributes.ColorScheme Methods readsPrec :: Int -> ReadS ColorScheme Source # readList :: ReadS [ColorScheme] Source # readPrec :: ReadPrec ColorScheme Source # readListPrec :: ReadPrec [ColorScheme] Source #
Show ColorScheme Source # |
Instance details Defined in Data.GraphViz.Attributes.ColorScheme Methods showsPrec :: Int -> ColorScheme -> ShowS Source # show :: ColorScheme -> String Source # showList :: [ColorScheme] -> ShowS Source #
Eq ColorScheme Source # |
Instance details Defined in Data.GraphViz.Attributes.ColorScheme Methods (==) :: ColorScheme -> ColorScheme -> Bool Source # (/=) :: ColorScheme -> ColorScheme -> Bool Source #
Ord ColorScheme Source # |

Instance details

Defined in Data.GraphViz.Attributes.ColorScheme

Methods

compare :: ColorScheme -> ColorScheme -> Ordering Source #

(<) :: ColorScheme -> ColorScheme -> Bool Source #

(<=) :: ColorScheme -> ColorScheme -> Bool Source #

(>) :: ColorScheme -> ColorScheme -> Bool Source #

(>=) :: ColorScheme -> ColorScheme -> Bool Source #

max :: ColorScheme -> ColorScheme -> ColorScheme Source #

min :: ColorScheme -> ColorScheme -> ColorScheme Source #

ParseDot ColorScheme Source # |
Instance details Defined in Data.GraphViz.Parsing Methods parseUnqt :: Parse ColorScheme Source # parse :: Parse ColorScheme Source # parseUnqtList :: Parse [ColorScheme] Source # parseList :: Parse [ColorScheme] Source #
PrintDot ColorScheme Source # |
Instance details Defined in Data.GraphViz.Printing Methods unqtDot :: ColorScheme -> DotCode Source # toDot :: ColorScheme -> DotCode Source # unqtListToDot :: [ColorScheme] -> DotCode Source # listToDot :: [ColorScheme] -> DotCode Source #

# Colors

data Color Source #

Defining a color for use with Graphviz. Note that named colors have been split up into `X11Color`s and those based upon the Brewer color schemes.

Constructors

RGB |

Fields

- red :: Word8
- green :: Word8
- blue :: Word8

RGBA |

Fields

- red :: Word8
- green :: Word8
- blue :: Word8
- alpha :: Word8

HSV | The `hue`, `saturation` and `value` values must all be `0 <= x <=1`.

Fields

- hue :: Double
- saturation :: Double
- value :: Double

X11Color X11Color |
SVGColor SVGColor |
BrewerColor BrewerColor |

#### Instances

Instances details

Read Color Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods readsPrec :: Int -> ReadS Color Source # readList :: ReadS [Color] Source # readPrec :: ReadPrec Color Source # readListPrec :: ReadPrec [Color] Source #
Show Color Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods showsPrec :: Int -> Color -> ShowS Source # show :: Color -> String Source # showList :: [Color] -> ShowS Source #
Eq Color Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods (==) :: Color -> Color -> Bool Source # (/=) :: Color -> Color -> Bool Source #
Ord Color Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods compare :: Color -> Color -> Ordering Source # (<) :: Color -> Color -> Bool Source # (<=) :: Color -> Color -> Bool Source # (>) :: Color -> Color -> Bool Source # (>=) :: Color -> Color -> Bool Source # max :: Color -> Color -> Color Source # min :: Color -> Color -> Color Source #
ParseDot Color Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods parseUnqt :: Parse Color Source # parse :: Parse Color Source # parseUnqtList :: Parse [Color] Source # parseList :: Parse [Color] Source #
PrintDot Color Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods unqtDot :: Color -> DotCode Source # toDot :: Color -> DotCode Source # unqtListToDot :: [Color] -> DotCode Source # listToDot :: [Color] -> DotCode Source #

type ColorList = [WeightedColor] Source #

The sum of the optional weightings must sum to at most `1`.

data WeightedColor Source #

A `Color` tagged with an optional weighting.

Constructors

WC |

Fields

- wColor :: Color
- weighting :: Maybe Double

  Must be in range `0 <= W <= 1`.

#### Instances

Instances details

Read WeightedColor Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods readsPrec :: Int -> ReadS WeightedColor Source # readList :: ReadS [WeightedColor] Source # readPrec :: ReadPrec WeightedColor Source # readListPrec :: ReadPrec [WeightedColor] Source #
Show WeightedColor Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods showsPrec :: Int -> WeightedColor -> ShowS Source # show :: WeightedColor -> String Source # showList :: [WeightedColor] -> ShowS Source #
Eq WeightedColor Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods (==) :: WeightedColor -> WeightedColor -> Bool Source # (/=) :: WeightedColor -> WeightedColor -> Bool Source #
Ord WeightedColor Source # |

Instance details

Defined in Data.GraphViz.Attributes.Colors

Methods

compare :: WeightedColor -> WeightedColor -> Ordering Source #

(<) :: WeightedColor -> WeightedColor -> Bool Source #

(<=) :: WeightedColor -> WeightedColor -> Bool Source #

(>) :: WeightedColor -> WeightedColor -> Bool Source #

(>=) :: WeightedColor -> WeightedColor -> Bool Source #

max :: WeightedColor -> WeightedColor -> WeightedColor Source #

min :: WeightedColor -> WeightedColor -> WeightedColor Source #

ParseDot WeightedColor Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods parseUnqt :: Parse WeightedColor Source # parse :: Parse WeightedColor Source # parseUnqtList :: Parse [WeightedColor] Source # parseList :: Parse [WeightedColor] Source #
PrintDot WeightedColor Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods unqtDot :: WeightedColor -> DotCode Source # toDot :: WeightedColor -> DotCode Source # unqtListToDot :: [WeightedColor] -> DotCode Source # listToDot :: [WeightedColor] -> DotCode Source #

toWC :: Color -> WeightedColor Source #

For colors without weightings.

toColorList :: [Color] -> ColorList Source #

For a list of colors without weightings.

class NamedColor nc where Source #

More easily convert named colors to an overall `Color` value.

Minimal complete definition

colorScheme, toColor, printNC, parseNC'

Methods

toColor :: nc -> Color Source #

#### Instances

Instances details

NamedColor BrewerColor Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods colorScheme :: BrewerColor -> ColorScheme toColor :: BrewerColor -> Color Source # printNC :: Bool -> BrewerColor -> DotCode parseNC' :: Bool -> Parse BrewerColor
NamedColor SVGColor Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods colorScheme :: SVGColor -> ColorScheme toColor :: SVGColor -> Color Source # printNC :: Bool -> SVGColor -> DotCode parseNC' :: Bool -> Parse SVGColor
NamedColor X11Color Source # |
Instance details Defined in Data.GraphViz.Attributes.Colors Methods colorScheme :: X11Color -> ColorScheme toColor :: X11Color -> Color Source # printNC :: Bool -> X11Color -> DotCode parseNC' :: Bool -> Parse X11Color

toWColor :: NamedColor nc => nc -> WeightedColor Source #

# Conversion to/from `Colour`.

toColour :: Color -> Maybe (AlphaColour Double) Source #

Attempt to convert a `Color` into a `Colour` value with an alpha channel. The use of `Maybe` is because the RGB values of the `BrewerColor`s haven't been stored here (primarily for licensing reasons).

fromColour :: Colour Double -> Color Source #

Convert a `Colour` value to an `RGB` `Color`.

fromAColour :: AlphaColour Double -> Color Source #

Convert an `AlphaColour` to an `RGBA` `Color`. The exception to this is for any `AlphaColour` which has `alphaChannel ac == 0`; these are converted to `X11Color `Transparent`` (note that the `Show` instance for such an `AlphaColour` is `"transparent"`).