Diagrams may have attributes which affect the way they are rendered. This module defines some common attributes; particular backends may also define more backend-specific attributes.
- class Color c where
- data SomeColor = forall c . Color c => SomeColor c
- newtype LineColor = LineColor SomeColor
- lineColor :: (Color c, HasStyle a) => c -> a -> a
- lc :: HasStyle a => Colour Double -> a -> a
- lcA :: HasStyle a => AlphaColour Double -> a -> a
- newtype FillColor = FillColor SomeColor
- fillColor :: (Color c, HasStyle a) => c -> a -> a
- fc :: HasStyle a => Colour Double -> a -> a
- fcA :: HasStyle a => AlphaColour Double -> a -> a
- newtype LineWidth = LineWidth Double
- lineWidth :: HasStyle a => Double -> a -> a
- lw :: HasStyle a => Double -> a -> a
- data LineCap
- lineCap :: HasStyle a => LineCap -> a -> a
- data LineJoin
- lineJoin :: HasStyle a => LineJoin -> a -> a
- data Dashing = Dashing [Double] Double
- dashing :: HasStyle a => [Double] -> Double -> a -> a
Diagrams outsources all things color-related to Russell O'Connor's very nice colour package (http://hackage.haskell.org/package/colour). For starters, it provides a large collection of standard color names. However, it also provides a rich set of combinators for combining and manipulating colors; see its documentation for more information.
Convert a color to red, green, blue, and alpha channels in the range [0,1].
An existential wrapper for instances of the
The color with which lines (strokes) are drawn.
The color with which shapes are filled.
The width of lines. By default, the line width is measured with
respect to the final coordinate system of a rendered diagram,
as opposed to the local coordinate systems in effect at the time
the line width was set for various subdiagrams. This is so that
it is easy to combine a variety of shapes (some created by
scaling) and have them all drawn using a consistent line width.
However, sometimes it is desirable for scaling to affect line
freeze operation is provided for this purpose. The
line width of frozen diagrams is affected by transformations.
What sort of shape should be placed at the endpoints of lines?
Lines end precisely at their endpoints.
Lines are capped with semicircles centered on endpoints.
Lines are capped with a squares centered on endpoints.
How should the join points between line segments be drawn?
Use a "miter" shape (whatever that is).
Use rounded join points.
Use a "bevel" shape (whatever that is). Are these... carpentry terms?
Create lines that are dashing... er, dashed.