Skip to content

Commit 9ad2f9b

Browse files
committed
Move black and white to the Color module
1 parent 3b773f2 commit 9ad2f9b

File tree

7 files changed

+44
-43
lines changed

7 files changed

+44
-43
lines changed

docs/Color.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@ hsl :: Number -> Number -> Number -> Color
6767

6868
Create a `Color` from hue, saturation, lightness and alpha values.
6969

70+
#### `black`
71+
72+
``` purescript
73+
black :: Color
74+
```
75+
76+
The color black.
77+
78+
#### `white`
79+
80+
``` purescript
81+
white :: Color
82+
```
83+
84+
The color white.
85+
7086
#### `grayscale`
7187

7288
``` purescript

docs/Color/Scheme/HTML.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## Module Color.Scheme.HTML
22

3-
Sixteen named colors from the HTML 4.01 specification.
4-
https://www.w3.org/TR/REC-html40/types.html#h-6.5
3+
Sixteen named colors from the HTML 4.01 specification (except black and
4+
white).
5+
See: https://www.w3.org/TR/REC-html40/types.html#h-6.5
56

67

78
### Re-exported from Color.Scheme.X11:
@@ -12,12 +13,6 @@ https://www.w3.org/TR/REC-html40/types.html#h-6.5
1213
aqua :: Color
1314
```
1415

15-
#### `black`
16-
17-
``` purescript
18-
black :: Color
19-
```
20-
2116
#### `blue`
2217

2318
``` purescript
@@ -90,12 +85,6 @@ silver :: Color
9085
teal :: Color
9186
```
9287

93-
#### `white`
94-
95-
``` purescript
96-
white :: Color
97-
```
98-
9988
#### `yellow`
10089

10190
``` purescript

docs/Color/Scheme/X11.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## Module Color.Scheme.X11
22

3-
X11 colors as specified by the CSS3 specification.
4-
https://www.w3.org/TR/css3-color/#svg-color
3+
X11 colors as specified by the CSS3 specification (except black and
4+
white).
5+
See: https://www.w3.org/TR/css3-color/#svg-color
56

67
#### `aliceblue`
78

@@ -45,12 +46,6 @@ beige :: Color
4546
bisque :: Color
4647
```
4748

48-
#### `black`
49-
50-
``` purescript
51-
black :: Color
52-
```
53-
5449
#### `blanchedalmond`
5550

5651
``` purescript
@@ -861,12 +856,6 @@ violet :: Color
861856
wheat :: Color
862857
```
863858

864-
#### `white`
865-
866-
``` purescript
867-
white :: Color
868-
```
869-
870859
#### `whitesmoke`
871860

872861
``` purescript

src/Color.purs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ module Color
88
, rgb'
99
, hsla
1010
, hsl
11+
, black
12+
, white
1113
, grayscale
1214
, toHSLA
1315
, toRGBA
@@ -106,6 +108,14 @@ hsla = HSLA
106108
hsl :: Number -> Number -> Number -> Color
107109
hsl h s l = HSLA h s l 1.0
108110

111+
-- | The color black.
112+
black :: Color
113+
black = hsl 0.0 0.0 0.0
114+
115+
-- | The color white.
116+
white :: Color
117+
white = hsl 0.0 0.0 1.0
118+
109119
-- | Create a gray tone from a lightness values (0.0 is black, 1.0 is white).
110120
grayscale :: Number -> Color
111121
grayscale l = hsl 0.0 0.0 l

src/Color/Scheme/HTML.purs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
-- | Sixteen named colors from the HTML 4.01 specification.
2-
-- | https://www.w3.org/TR/REC-html40/types.html#h-6.5
1+
-- | Sixteen named colors from the HTML 4.01 specification (except black and
2+
-- | white).
3+
-- | See: https://www.w3.org/TR/REC-html40/types.html#h-6.5
4+
35
module Color.Scheme.HTML
46
(module Color.Scheme.X11
57
) where
68

7-
import Color.Scheme.X11 (black, silver, gray, white, maroon, red, purple,
8-
fuchsia, green, lime, olive, yellow, navy, blue, teal,
9-
aqua)
9+
import Color.Scheme.X11 (silver, gray, maroon, red, purple, fuchsia, green,
10+
lime, olive, yellow, navy, blue, teal, aqua)

src/Color/Scheme/X11.purs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
-- | X11 colors as specified by the CSS3 specification.
2-
-- | https://www.w3.org/TR/css3-color/#svg-color
1+
-- | X11 colors as specified by the CSS3 specification (except black and
2+
-- | white).
3+
-- | See: https://www.w3.org/TR/css3-color/#svg-color
4+
35
module Color.Scheme.X11 where
46

57
import Color (Color(), rgb)
@@ -25,9 +27,6 @@ beige = rgb 245 245 220
2527
bisque :: Color
2628
bisque = rgb 255 228 196
2729

28-
black :: Color
29-
black = rgb 0 0 0
30-
3130
blanchedalmond :: Color
3231
blanchedalmond = rgb 255 235 205
3332

@@ -433,9 +432,6 @@ violet = rgb 238 130 238
433432
wheat :: Color
434433
wheat = rgb 245 222 179
435434

436-
white :: Color
437-
white = rgb 255 255 255
438-
439435
whitesmoke :: Color
440436
whitesmoke = rgb 245 245 245
441437

test/Interactive.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ main = do
5252
doc "rgba" $
5353
(\(Int255 r) (Int255 g) (Int255 b) (Number1 a) -> TColor (rgba r g b a))
5454
doc "cssStringHSLA" (\(TColor c) -> cssStringHSLA c)
55+
doc "black" (TColor black)
56+
doc "white" (TColor white)
5557
doc "grayscale" (\(Number1 s) -> TColor (grayscale s))
5658
doc "complementary" (\(TColor c) -> TColor (complementary c))
5759
doc "lighten" (\(Number1 a) (TColor c) -> TColor (lighten a c))
@@ -92,7 +94,6 @@ main = do
9294
docx11 "azure" (TColor azure)
9395
docx11 "beige" (TColor beige)
9496
docx11 "bisque" (TColor bisque)
95-
docx11 "black" (TColor black)
9697
docx11 "blanchedalmond" (TColor blanchedalmond)
9798
docx11 "blue" (TColor blue)
9899
docx11 "blueviolet" (TColor blueviolet)
@@ -228,7 +229,6 @@ main = do
228229
docx11 "turquoise" (TColor turquoise)
229230
docx11 "violet" (TColor violet)
230231
docx11 "wheat" (TColor wheat)
231-
docx11 "white" (TColor white)
232232
docx11 "whitesmoke" (TColor whitesmoke)
233233
docx11 "yellow" (TColor yellow)
234234
docx11 "yellowgreen" (TColor yellowgreen)

0 commit comments

Comments
 (0)