Skip to content

Commit c7b9e05

Browse files
committed
Document clone()
1 parent b76321f commit c7b9e05

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,13 @@ See [index.html](https://github.com/bgrins/TinyColor/blob/master/index.html) in
453453

454454
## Common operations
455455

456-
### Cloning
456+
### clone
457457

458-
To clone a color, you can simply instantiate a new tinycolor with the old one's `toString` output. The new color is a copy of the first one, so any changes to one won't affect the other. See this example:
458+
`clone: function() -> TinyColor`.
459+
Instantiate a new TinyColor object with the same color. Any changes to the new one won't affect the old one.
459460

460461
var color1 = tinycolor("#F00");
461-
var color2 = tinycolor(color1.toString());
462+
var color2 = color1.clone();
462463
color2.setAlpha(.5);
463464

464465
color1.toString(); // "#ff0000"

0 commit comments

Comments
 (0)