Skip to content

Commit 52b26cd

Browse files
committed
Updated documentation.
1 parent 430e478 commit 52b26cd

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,7 @@ by the module. Use the `getContext()` method on the canvas to get a `CanvasConte
6565

6666
* `backColor` (color)
6767

68-
Specifies the background color. Allowed values are:
69-
70-
* 32 bit integers on the format `0xRRGGBBAA`
71-
* strings on the format `"#RGB"`
72-
* strings on the format `"#RRGGBB"`
73-
* strings on the format `"#RRGGBBAA"`
74-
68+
Specifies the background color. See `fillStyle` below for allowed values.
7569
Default is transparent.
7670

7771
#### Methods
@@ -96,9 +90,30 @@ by the module. Use the `getContext()` method on the canvas to get a `CanvasConte
9690
Specifies the fill color that is used when the `fill()` method is called. Allowed values are:
9791

9892
* 32 bit integers on the format `0xRRGGBBAA`
99-
* strings on the format `"#RGB"`
100-
* strings on the format `"#RRGGBB"`
101-
* strings on the format `"#RRGGBBAA"`
93+
* string `"transparent"`
94+
* strings on the format `"#2c4"` (#RGB)
95+
* strings on the format `"#2c4f"` (#RGBA)
96+
* strings on the format `"#22cc44"` (#RRGGBB)
97+
* strings on the format `"#22cc44ff"` (#RRGGBBAA)
98+
* strings on the format `"rgb(255, 124, 22)"`
99+
* strings on the format `"rgb(255, 124, 22, 0.5)"`
100+
* strings on the format `"rgb(255, 124, 22, 50%)"`
101+
* strings on the format `"rgba(255, 124, 22, 0.5)"`
102+
* strings on the format `"rgba(255, 124, 22, 50%)"`
103+
* strings on the format `"rgb(23%, 45%, 75%)"`
104+
* strings on the format `"rgb(23%, 45%, 75%, 0.5)"`
105+
* strings on the format `"rgb(23%, 45%, 75%, 50%)"`
106+
* strings on the format `"rgba(23%, 45%, 75%, 0.5)"`
107+
* strings on the format `"rgba(23%, 45%, 75%, 50%)"`
108+
* strings on the format `"hsl(134, 50%, 50%)"`
109+
* strings on the format `"hsl(134, 50%, 50%, 0.5)"`
110+
* strings on the format `"hsl(134, 50%, 50%, 50%)"`
111+
* strings on the format `"hsla(134, 50%, 50%, 0.5)"`
112+
* strings on the format `"hsla(134, 50%, 50%, 50%)"`
113+
* strings on the format `"hwb(134, 50%, 50%)"`
114+
* strings on the format `"hwb(134, 50%, 50%, 0.5)"`
115+
* strings on the format `"hwb(134, 50%, 50%, 50%)"`
116+
* named colors listed in [CSS Color Module Level 4](https://www.w3.org/TR/css-color-4/#named-colors)
102117

103118
#### Paths
104119

lib/canvasContext.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@ function CanvasContext(canvas) {
5555
* - strings on the format #RRGGBBAA
5656
* - strings on the format rgb(255, 255, 255)
5757
* - strings on the format rgb(255, 255, 255, 0.5)
58+
* - strings on the format rgb(255, 255, 255, 50%)
5859
* - strings on the format rgba(255, 255, 255, 0.5)
60+
* - strings on the format rgba(255, 255, 255, 50%)
5961
* - strings on the format hsl(134, 50%, 50%)
6062
* - strings on the format hsl(134, 50%, 50%, 0.5)
63+
* - strings on the format hsl(134, 50%, 50%, 50%)
6164
* - strings on the format hsla(134, 50%, 50%, 0.5)
65+
* - strings on the format hsla(134, 50%, 50%, 50%)
6266
* - strings on the format hwb(134, 50%, 50%)
6367
* - strings on the format hwb(134, 50%, 50%, 0.5)
68+
* - strings on the format hwb(134, 50%, 50%, 50%)
6469
* @public
6570
*/
6671
CanvasContext.prototype.fillStyle = 0x000000ff;

tests/colorUtils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ tap.equal("#abcdef21", colorUtils.format(colorUtils.parse("#abcdef21")));
1515
tap.equal("#aabbccff", colorUtils.format(colorUtils.parse("#abc")));
1616
tap.equal("#aabbccff", colorUtils.format(colorUtils.parse("#aabbcc")));
1717
tap.equal("#fffefdff", colorUtils.format(colorUtils.parse("rgb(255, 254, 253)")));
18+
tap.equal("#ff7f00ff", colorUtils.format(colorUtils.parse("rgb(100%, 50%, 0%)")));
1819
tap.equal("#fffefd7f", colorUtils.format(colorUtils.parse("rgb(255, 254, 253, 0.5)")));
1920
tap.equal("#fffefd7f", colorUtils.format(colorUtils.parse("rgba(255, 254, 253, 0.5)")));
2021
tap.equal("#adcbaeff", colorUtils.format(colorUtils.parse("hsl(123, 23%, 74% )")));

0 commit comments

Comments
 (0)