module Graphics.Gnuplot.ColorSpecification (
   T,
   rgb,
   rgb8,
   name,
   paletteFrac,

   white,
   black,
   gray0,
   grey0,
   gray10,
   grey10,
   gray20,
   grey20,
   gray30,
   grey30,
   gray40,
   grey40,
   gray50,
   grey50,
   gray60,
   grey60,
   gray70,
   grey70,
   gray80,
   grey80,
   gray90,
   grey90,
   gray100,
   grey100,
   gray,
   grey,
   lightGray,
   lightGrey,
   darkGray,
   darkGrey,
   red,
   lightRed,
   darkRed,
   yellow,
   lightYellow,
   darkYellow,
   green,
   lightGreen,
   darkGreen,
   springGreen,
   forestGreen,
   seaGreen,
   blue,
   lightBlue,
   darkBlue,
   midnightBlue,
   navy,
   mediumBlue,
   royalblue,
   skyblue,
   cyan,
   lightCyan,
   darkCyan,
   magenta,
   lightMagenta,
   darkMagenta,
   turquoise,
   lightTurquoise,
   darkTurquoise,
   pink,
   lightPink,
   darkPink,
   coral,
   lightCoral,
   orangeRed,
   salmon,
   lightSalmon,
   darkSalmon,
   aquamarine,
   khaki,
   darkKhaki,
   goldenrod,
   lightGoldenrod,
   darkGoldenrod,
   gold,
   beige,
   brown,
   orange,
   darkOrange,
   violet,
   darkViolet,
   plum,
   purple,

   ) where

import qualified Graphics.Gnuplot.Private.ColorSpecification as Color
import Graphics.Gnuplot.Private.ColorSpecification (T, )
import Data.Ord.HT (limit, )
import Data.Word (Word8, )


{- |
Color components for Red, Green, Blue, must be in the range @[0,1]@.
-}
rgb :: Double -> Double -> Double -> T
rgb :: Double -> Double -> Double -> T
rgb Double
r Double
g Double
b =
   Word8 -> Word8 -> Word8 -> T
rgb8 (Double -> Word8
word8FromDouble Double
r) (Double -> Word8
word8FromDouble Double
g) (Double -> Word8
word8FromDouble Double
b)

word8FromDouble :: Double -> Word8
word8FromDouble :: Double -> Word8
word8FromDouble Double
c =
   Double -> Word8
forall a b. (RealFrac a, Integral b) => a -> b
round ((Double, Double) -> Double -> Double
forall a. Ord a => (a, a) -> a -> a
limit (Double
0,Double
1) Double
c Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double
255)

rgb8 :: Word8 -> Word8 -> Word8 -> T
rgb8 :: Word8 -> Word8 -> Word8 -> T
rgb8 = Word8 -> Word8 -> Word8 -> T
Color.RGB8

paletteFrac :: Double -> T
paletteFrac :: Double -> T
paletteFrac = Double -> T
Color.PaletteFrac

{- |
Specify a color by name.
You are responsible for choosing an existing name in gnuplot.
If your color is available as Haskell variable in this module,
then prefer this one.
-}
name :: String -> T
name :: String -> T
name = String -> T
Color.Name


{-
This function chooses how we represent below colors in gnuplot.
If we use RGB values then we stay independent from the available color names
in the current gnuplot version.
If we use color names, then the generated gnuplot scripts are more readable.
-}
makeColor :: String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor :: String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
str Int
_ Word8
_ Word8
_ Word8
_ = String -> T
name String
str


white,
 black,
 gray0,
 grey0,
 gray10,
 grey10,
 gray20,
 grey20,
 gray30,
 grey30,
 gray40,
 grey40,
 gray50,
 grey50,
 gray60,
 grey60,
 gray70,
 grey70,
 gray80,
 grey80,
 gray90,
 grey90,
 gray100,
 grey100,
 gray,
 grey,
 lightGray,
 lightGrey,
 darkGray,
 darkGrey,
 red,
 lightRed,
 darkRed,
 yellow,
 lightYellow,
 darkYellow,
 green,
 lightGreen,
 darkGreen,
 springGreen,
 forestGreen,
 seaGreen,
 blue,
 lightBlue,
 darkBlue,
 midnightBlue,
 navy,
 mediumBlue,
 royalblue,
 skyblue,
 cyan,
 lightCyan,
 darkCyan,
 magenta,
 lightMagenta,
 darkMagenta,
 turquoise,
 lightTurquoise,
 darkTurquoise,
 pink,
 lightPink,
 darkPink,
 coral,
 lightCoral,
 orangeRed,
 salmon,
 lightSalmon,
 darkSalmon,
 aquamarine,
 khaki,
 darkKhaki,
 goldenrod,
 lightGoldenrod,
 darkGoldenrod,
 gold,
 beige,
 brown,
 orange,
 darkOrange,
 violet,
 darkViolet,
 plum,
 purple :: T

{-
gnuplot> show colornames
-}

white :: T
white             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"white"              Int
0xffffff Word8
255 Word8
255 Word8
255
black :: T
black             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"black"              Int
0x000000   Word8
0   Word8
0   Word8
0
gray0 :: T
gray0             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray0"              Int
0x000000   Word8
0   Word8
0   Word8
0
grey0 :: T
grey0             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey0"              Int
0x000000   Word8
0   Word8
0   Word8
0
gray10 :: T
gray10            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray10"             Int
0x1a1a1a  Word8
26  Word8
26  Word8
26
grey10 :: T
grey10            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey10"             Int
0x1a1a1a  Word8
26  Word8
26  Word8
26
gray20 :: T
gray20            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray20"             Int
0x333333  Word8
51  Word8
51  Word8
51
grey20 :: T
grey20            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey20"             Int
0x333333  Word8
51  Word8
51  Word8
51
gray30 :: T
gray30            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray30"             Int
0x4d4d4d  Word8
77  Word8
77  Word8
77
grey30 :: T
grey30            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey30"             Int
0x4d4d4d  Word8
77  Word8
77  Word8
77
gray40 :: T
gray40            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray40"             Int
0x666666 Word8
102 Word8
102 Word8
102
grey40 :: T
grey40            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey40"             Int
0x666666 Word8
102 Word8
102 Word8
102
gray50 :: T
gray50            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray50"             Int
0x7f7f7f Word8
127 Word8
127 Word8
127
grey50 :: T
grey50            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey50"             Int
0x7f7f7f Word8
127 Word8
127 Word8
127
gray60 :: T
gray60            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray60"             Int
0x999999 Word8
153 Word8
153 Word8
153
grey60 :: T
grey60            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey60"             Int
0x999999 Word8
153 Word8
153 Word8
153
gray70 :: T
gray70            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray70"             Int
0xb3b3b3 Word8
179 Word8
179 Word8
179
grey70 :: T
grey70            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey70"             Int
0xb3b3b3 Word8
179 Word8
179 Word8
179
gray80 :: T
gray80            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray80"             Int
0xcccccc Word8
204 Word8
204 Word8
204
grey80 :: T
grey80            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey80"             Int
0xcccccc Word8
204 Word8
204 Word8
204
gray90 :: T
gray90            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray90"             Int
0xe5e5e5 Word8
229 Word8
229 Word8
229
grey90 :: T
grey90            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey90"             Int
0xe5e5e5 Word8
229 Word8
229 Word8
229
gray100 :: T
gray100           = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray100"            Int
0xffffff Word8
255 Word8
255 Word8
255
grey100 :: T
grey100           = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey100"            Int
0xffffff Word8
255 Word8
255 Word8
255
gray :: T
gray              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gray"               Int
0xbebebe Word8
190 Word8
190 Word8
190
grey :: T
grey              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"grey"               Int
0xbebebe Word8
190 Word8
190 Word8
190
lightGray :: T
lightGray         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-gray"         Int
0xd3d3d3 Word8
211 Word8
211 Word8
211
lightGrey :: T
lightGrey         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-grey"         Int
0xd3d3d3 Word8
211 Word8
211 Word8
211
darkGray :: T
darkGray          = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-gray"          Int
0xa9a9a9 Word8
169 Word8
169 Word8
169
darkGrey :: T
darkGrey          = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-grey"          Int
0xa9a9a9 Word8
169 Word8
169 Word8
169
red :: T
red               = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"red"                Int
0xff0000 Word8
255   Word8
0   Word8
0
lightRed :: T
lightRed          = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-red"          Int
0xf03232 Word8
240  Word8
50  Word8
50
darkRed :: T
darkRed           = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-red"           Int
0x8b0000 Word8
139   Word8
0   Word8
0
yellow :: T
yellow            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"yellow"             Int
0xffff00 Word8
255 Word8
255   Word8
0
lightYellow :: T
lightYellow       = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-yellow"       Int
0xffffe0 Word8
255 Word8
255 Word8
224
darkYellow :: T
darkYellow        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-yellow"        Int
0xc8c800 Word8
200 Word8
200   Word8
0
green :: T
green             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"green"              Int
0x00ff00   Word8
0 Word8
255   Word8
0
lightGreen :: T
lightGreen        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-green"        Int
0x90ee90 Word8
144 Word8
238 Word8
144
darkGreen :: T
darkGreen         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-green"         Int
0x006400   Word8
0 Word8
100   Word8
0
springGreen :: T
springGreen       = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"spring-green"       Int
0x00ff7f   Word8
0 Word8
255 Word8
127
forestGreen :: T
forestGreen       = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"forest-green"       Int
0x228b22  Word8
34 Word8
139  Word8
34
seaGreen :: T
seaGreen          = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"sea-green"          Int
0x2e8b57  Word8
46 Word8
139  Word8
87
blue :: T
blue              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"blue"               Int
0x0000ff   Word8
0   Word8
0 Word8
255
lightBlue :: T
lightBlue         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-blue"         Int
0xadd8e6 Word8
173 Word8
216 Word8
230
darkBlue :: T
darkBlue          = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-blue"          Int
0x00008b   Word8
0   Word8
0 Word8
139
midnightBlue :: T
midnightBlue      = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"midnight-blue"      Int
0x191970  Word8
25  Word8
25 Word8
112
navy :: T
navy              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"navy"               Int
0x000080   Word8
0   Word8
0 Word8
128
mediumBlue :: T
mediumBlue        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"medium-blue"        Int
0x0000cd   Word8
0   Word8
0 Word8
205
royalblue :: T
royalblue         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"royalblue"          Int
0x4169e1  Word8
65 Word8
105 Word8
225
skyblue :: T
skyblue           = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"skyblue"            Int
0x87ceeb Word8
135 Word8
206 Word8
235
cyan :: T
cyan              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"cyan"               Int
0x00ffff   Word8
0 Word8
255 Word8
255
lightCyan :: T
lightCyan         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-cyan"         Int
0xe0ffff Word8
224 Word8
255 Word8
255
darkCyan :: T
darkCyan          = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-cyan"          Int
0x008b8b   Word8
0 Word8
139 Word8
139
magenta :: T
magenta           = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"magenta"            Int
0xff00ff Word8
255   Word8
0 Word8
255
lightMagenta :: T
lightMagenta      = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-magenta"      Int
0xf055f0 Word8
240  Word8
85 Word8
240
darkMagenta :: T
darkMagenta       = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-magenta"       Int
0x8b008b Word8
139   Word8
0 Word8
139
turquoise :: T
turquoise         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"turquoise"          Int
0x40e0d0  Word8
64 Word8
224 Word8
208
lightTurquoise :: T
lightTurquoise    = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-turquoise"    Int
0xafeeee Word8
175 Word8
238 Word8
238
darkTurquoise :: T
darkTurquoise     = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-turquoise"     Int
0x00ced1   Word8
0 Word8
206 Word8
209
pink :: T
pink              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"pink"               Int
0xffc0cb Word8
255 Word8
192 Word8
203
lightPink :: T
lightPink         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-pink"         Int
0xffb6c1 Word8
255 Word8
182 Word8
193
darkPink :: T
darkPink          = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-pink"          Int
0xff1493 Word8
255  Word8
20 Word8
147
coral :: T
coral             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"coral"              Int
0xff7f50 Word8
255 Word8
127  Word8
80
lightCoral :: T
lightCoral        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-coral"        Int
0xf08080 Word8
240 Word8
128 Word8
128
orangeRed :: T
orangeRed         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"orange-red"         Int
0xff4500 Word8
255  Word8
69   Word8
0
salmon :: T
salmon            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"salmon"             Int
0xfa8072 Word8
250 Word8
128 Word8
114
lightSalmon :: T
lightSalmon       = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-salmon"       Int
0xffa07a Word8
255 Word8
160 Word8
122
darkSalmon :: T
darkSalmon        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-salmon"        Int
0xe9967a Word8
233 Word8
150 Word8
122
aquamarine :: T
aquamarine        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"aquamarine"         Int
0x7fffd4 Word8
127 Word8
255 Word8
212
khaki :: T
khaki             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"khaki"              Int
0xf0e68c Word8
240 Word8
230 Word8
140
darkKhaki :: T
darkKhaki         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-khaki"         Int
0xbdb76b Word8
189 Word8
183 Word8
107
goldenrod :: T
goldenrod         = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"goldenrod"          Int
0xdaa520 Word8
218 Word8
165  Word8
32
lightGoldenrod :: T
lightGoldenrod    = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"light-goldenrod"    Int
0xeedd82 Word8
238 Word8
221 Word8
130
darkGoldenrod :: T
darkGoldenrod     = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-goldenrod"     Int
0xb8860b Word8
184 Word8
134  Word8
11
gold :: T
gold              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"gold"               Int
0xffd700 Word8
255 Word8
215   Word8
0
beige :: T
beige             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"beige"              Int
0xf5f5dc Word8
245 Word8
245 Word8
220
brown :: T
brown             = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"brown"              Int
0xa52a2a Word8
165  Word8
42  Word8
42
orange :: T
orange            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"orange"             Int
0xffa500 Word8
255 Word8
165   Word8
0
darkOrange :: T
darkOrange        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-orange"        Int
0xff8c00 Word8
255 Word8
140   Word8
0
violet :: T
violet            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"violet"             Int
0xee82ee Word8
238 Word8
130 Word8
238
darkViolet :: T
darkViolet        = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"dark-violet"        Int
0x9400d3 Word8
148   Word8
0 Word8
211
plum :: T
plum              = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"plum"               Int
0xdda0dd Word8
221 Word8
160 Word8
221
purple :: T
purple            = String -> Int -> Word8 -> Word8 -> Word8 -> T
makeColor String
"purple"             Int
0xa020f0 Word8
160  Word8
32 Word8
240