Skip to content

Commit

Permalink
docs: add properties isValid and format
Browse files Browse the repository at this point in the history
  • Loading branch information
scttcper committed May 2, 2018
1 parent 78c1eda commit 77dab97
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A fork of [tinycolor2](https://github.com/bgrins/TinyColor) by [Brian Grinstead]
* added polyad colors tinycolor PR [126](https://github.com/bgrins/TinyColor/pull/126)
* color wheel values (360) are allowed to over or under-spin and still return valid colors tinycolor PR [108](https://github.com/bgrins/TinyColor/pull/108)
* added `tint()` and `shade()` tinycolor PR [159](https://github.com/bgrins/TinyColor/pull/159)
* `isValid` is now a property instead of a function
* `isValid`, `format` are now propertys instead of a function

## Install

Expand Down Expand Up @@ -118,28 +118,17 @@ If you are calling this from code, you may want to use object input. Here are so
{ h: 0, s: 100, v: 100 }
```

## Methods
## Properties

### getFormat
### format

Returns the format used to create the tinycolor instance

```ts
const color = new TinyColor('red');
color.getFormat(); // "name"
color.format; // "name"
color = new TinyColor({ r: 255, g: 255, b: 255 });
color.getFormat(); // "rgb"
```

### getOriginalInput

Returns the input passed into the constructer used to create the tinycolor instance

```ts
const color = new TinyColor('red');
color.getOriginalInput(); // "red"
color = new TinyColor({ r: 255, g: 255, b: 255 });
color.getOriginalInput(); // "{r: 255, g: 255, b: 255}"
color.format; // "rgb"
```

### isValid
Expand All @@ -156,6 +145,19 @@ color2.isValid; // false
color2.toString(); // "#000000"
```

## Methods

### getOriginalInput

Returns the input passed into the constructer used to create the tinycolor instance

```ts
const color = new TinyColor('red');
color.getOriginalInput(); // "red"
color = new TinyColor({ r: 255, g: 255, b: 255 });
color.getOriginalInput(); // "{r: 255, g: 255, b: 255}"
```

### getBrightness

Returns the perceived brightness of a color, from `0-255`, as defined by [Web Content Accessibility Guidelines (Version 1.0)](http://www.w3.org/TR/AERT#color-contrast).
Expand Down

0 comments on commit 77dab97

Please sign in to comment.