Skip to content

Commit d7d01d7

Browse files
committed
Tweak docs per #73
1 parent d1a7ab2 commit d7d01d7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Here are some examples of string input:
7171
tinycolor("hsl(0, 100%, 50%)");
7272
tinycolor("hsl 0 1.0 0.5");
7373
tinycolor({ h: 0, s: 1, l: .5 });
74+
tinycolor.fromRatio({ h: 1, s: 0, l: 0 });
75+
tinycolor.fromRatio({ h: .5, s: .5, l: .5 });
7476

7577
### HSV, HSVA
7678

@@ -79,6 +81,8 @@ Here are some examples of string input:
7981
tinycolor("hsv (0 100% 100%)");
8082
tinycolor("hsv 0 1 1");
8183
tinycolor({ h: 0, s: 100, v: 100 });
84+
tinycolor.fromRatio({ h: 1, s: 0, v: 0 });
85+
tinycolor.fromRatio({ h: .5, s: .5, v: .5 });
8286

8387
### Named
8488

@@ -182,6 +186,10 @@ Sets the alpha value on a current color. Accepted range is in between `0-1`.
182186
color.getAlpha(); // .5
183187
color.toRgbString(); // "rgba(255, 0, 0, .5)"
184188

189+
### String Representations
190+
191+
The following methods will return a property for the `alpha` value, which can be ignored: `toHsv`, `toHsl`, `toRgb`
192+
185193
### toHsv
186194

187195
var color = tinycolor("red");
@@ -191,6 +199,8 @@ Sets the alpha value on a current color. Accepted range is in between `0-1`.
191199

192200
var color = tinycolor("red");
193201
color.toHsvString(); // "hsv(0, 100%, 100%)"
202+
color.setAlpha(0.5);
203+
color.toHsvString(); // "hsla(0, 100%, 100%, 0.5)"
194204

195205
### toHsl
196206

@@ -201,6 +211,8 @@ Sets the alpha value on a current color. Accepted range is in between `0-1`.
201211

202212
var color = tinycolor("red");
203213
color.toHslString(); // "hsl(0, 100%, 50%)"
214+
color.setAlpha(0.5);
215+
color.toHslString(); // "hsla(0, 100%, 50%, 0.5)"
204216

205217
### toHex
206218

@@ -231,6 +243,8 @@ Sets the alpha value on a current color. Accepted range is in between `0-1`.
231243

232244
var color = tinycolor("red");
233245
color.toRgbString(); // "rgb(255, 0, 0)"
246+
color.setAlpha(0.5);
247+
color.toRgbString(); // "rgba(255, 0, 0, 0.5)"
234248

235249
### toPercentageRgb
236250

@@ -241,6 +255,8 @@ Sets the alpha value on a current color. Accepted range is in between `0-1`.
241255

242256
var color = tinycolor("red");
243257
color.toPercentageRgbString(); // "rgb(100%, 0%, 0%)"
258+
color.setAlpha(0.5);
259+
color.toPercentageRgbString(); // "rgba(100%, 0%, 0%, 0.5)"
244260

245261
### toName
246262

0 commit comments

Comments
 (0)