Skip to content

Commit 38ec4f3

Browse files
committed
Update docs and HTML
1 parent 4a0ebc7 commit 38ec4f3

File tree

3 files changed

+46
-8
lines changed

3 files changed

+46
-8
lines changed

docs/Flare.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,22 @@ radioGroup_ :: forall e a. a -> Array a -> (a -> String) -> UI e a
282282

283283
Like `radioGroup`, but without a label.
284284

285+
#### `color`
286+
287+
``` purescript
288+
color :: forall e. Label -> Color -> UI e Color
289+
```
290+
291+
Creates a color picker input field from a label and default `Color`.
292+
293+
#### `color_`
294+
295+
``` purescript
296+
color_ :: forall e. Color -> UI e Color
297+
```
298+
299+
Like `color`, but without a label.
300+
285301
#### `fieldset`
286302

287303
``` purescript

docs/Flare/Drawing.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,16 @@ fontString :: Font -> String
232232

233233
Turn a `Font` into a `String` which can be used with `Graphics.Canvas.setFont`.
234234

235+
#### `fromHexString`
236+
237+
``` purescript
238+
fromHexString :: String -> Maybe Color
239+
```
240+
241+
Parse a hexadecimal RGB code of the form `#rgb` or `#rrggbb`, where the
242+
hexadecimal digits are of the format [0-9a-f] (case insensitive). Returns
243+
`Nothing` if the string is in a wrong format.
244+
235245
#### `grayscale`
236246

237247
``` purescript
@@ -434,6 +444,17 @@ toHSLA :: Color -> { h :: Number, s :: Number, l :: Number, a :: Number }
434444

435445
Convert a `Color` to its hue, saturation, lightness and alpha values.
436446

447+
#### `toHexString`
448+
449+
``` purescript
450+
toHexString :: Color -> String
451+
```
452+
453+
Return a hexadecimal representation of the color in the form `#rrggbb`,
454+
where `rr`, `gg` and `bb` refer to hexadecimal digits corresponding to
455+
the RGB channel values between `00` and `ff`. The alpha channel is not
456+
represented.
457+
437458
#### `toRGBA`
438459

439460
``` purescript

html/index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ <h3>Example 6: Select box</h3>
7272

7373
<h3>Example 7: Integration with Signals (Superformula)</h3>
7474
<pre>
75-
plot m n1 s time =
76-
filled (fillColor (hsl 333.0 0.6 0.5)) $
75+
plot m n1 s col time =
76+
filled (fillColor col) $
7777
path (map point angles)
7878

7979
where point phi = { x: 100.0 + radius phi * cos phi
@@ -83,15 +83,16 @@ <h3>Example 7: Integration with Signals (Superformula)</h3>
8383
points = 400
8484
n2 = s + 3.0 * sin (0.005 * time)
8585
n3 = s + 3.0 * cos (0.005 * time)
86-
radius phi = 20.0 * pow inner (- 1.0 / n1)
87-
where inner = first + second
86+
radius phi = 20.0 * pow expr (- 1.0 / n1)
87+
where expr = first + second
8888
first = pow (abs (cos (m * phi / 4.0))) n2
8989
second = pow (abs (sin (m * phi / 4.0))) n3
9090

91-
ui = plot <$> (numberSlider "m" 0.0 10.0 1.0 7.0)
92-
<*> (numberSlider "n1" 1.0 10.0 0.1 4.0)
93-
<*> (numberSlider "s" 4.0 16.0 0.1 14.0)
94-
<*> lift animationFrame
91+
ui7 = plot <$> (numberSlider "m" 0.0 10.0 1.0 7.0)
92+
<*> (numberSlider "n1" 1.0 10.0 0.1 4.0)
93+
<*> (numberSlider "s" 4.0 16.0 0.1 14.0)
94+
<*> (color "Color" (hsl 333.0 0.6 0.5))
95+
<*> lift animationFrame
9596
</pre>
9697
<div id="controls7"></div>
9798
<canvas id="output7" width="200" height="200"></canvas>

0 commit comments

Comments
 (0)