Merge pull request #100 from ngradwohl/feature/hsla

add new hsl function
This commit is contained in:
Лu Лinveгa 2019-08-03 08:57:51 +12:00 committed by GitHub
commit d6317b62fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,7 @@ Ronin helpers are keywords that facilitates adding coordinates from the canvas i
- `(text x y p t ~a ~f)` Returns a text shape. - `(text x y p t ~a ~f)` Returns a text shape.
- `(svg x y d)` Returns a svg shape. - `(svg x y d)` Returns a svg shape.
- `(color r g b ~a)` Returns a color object. - `(color r g b ~a)` Returns a color object.
- `(hsl r g b ~a)` Returns a HSL color object.
- `(frame)` Returns a rect of the frame. - `(frame)` Returns a rect of the frame.
- `(resize ~w)` Resizes the canvas to target w and h, returns the rect. - `(resize ~w)` Resizes the canvas to target w and h, returns the rect.
- `(rescale ~w ~h)` Rescales the canvas to target ratio of w and h, returns the rect. - `(rescale ~w ~h)` Rescales the canvas to target ratio of w and h, returns the rect.

View File

@ -74,6 +74,10 @@ function Library (ronin) {
return { r, g, b, a, hex, toString: () => { return `rgba(${r},${g},${b},${a})` }, 0: r, 1: g, 2: b, 3: a, f: [r / 255, g / 255, b / 255, a] } return { r, g, b, a, hex, toString: () => { return `rgba(${r},${g},${b},${a})` }, 0: r, 1: g, 2: b, 3: a, f: [r / 255, g / 255, b / 255, a] }
} }
this.hsl = (h, s, l, a = 1) => { // returns a HSL color object
return { h, s, l, a, toString: () => { return `hsla(${h},${s}%,${l}%,${a})` }, 0: h, 1: s, 2: l, 3: a, f: [h / 360, s / 100, l / 100, a] }
}
// Frame // Frame
this.frame = () => { // Returns a rect of the frame. this.frame = () => { // Returns a rect of the frame.