Skip to content

Commit

Permalink
fix(Document): wrong object structure for rgba format color
Browse files Browse the repository at this point in the history
  • Loading branch information
linx4200 committed Feb 2, 2018
1 parent 2eb409d commit e5db200
Showing 1 changed file with 17 additions and 37 deletions.
54 changes: 17 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,41 +56,23 @@ npm run dev
```

## Usage

```js

var defaultProps = {
var colors = {
hex: '#194d33',
hsl: {
h: 150,
s: 0.5,
l: 0.2,
a: 1
},
hsv: {
h: 150,
s: 0.66,
v: 0.30,
a: 1
},
rgba: {
r: 25,
g: 77,
b: 51,
a: 1
},
hsl: { h: 150, s: 0.5, l: 0.2, a: 1 },
hsv: { h: 150, s: 0.66, v: 0.30, a: 1 },
rgba: { r: 25, g: 77, b: 51, a: 1 },
a: 1
}

// or defaultProps can be
var defaultProps = '#194d33'
// or
var colors = '#194d33'
// or
var defaultProps = {
h: 150,
s: 0.66,
v: 0.30
}
// or a object of rgb or hsl

var colors = { h: 150, s: 0.66, v: 0.30 }
// or
var colors = { r: 255, g: 0, b: 0 }
// etc...

new Vue({
el: '#app',
Expand All @@ -103,13 +85,17 @@ new Vue({
'chrome-picker': chrome,
'photoshop-picker': photoshop
},
data: {
colors: defaultProps
data () {
return {
colors
}
}
})

```

`colors` accepts either a string of a hex color '#333' or a object of rgb or hsl values `{ r: 51, g: 51, b: 51 }` or `{ h: 0, s: 0, l: .10 }`, whatever [tinycolor2](https://www.npmjs.com/package/tinycolor2) accepts as an input.

```html
<!-- suppose you have the data 'colors' in your component -->
<material-picker v-model="colors" />
Expand All @@ -127,12 +113,6 @@ OR
<chrome-picker :value="colors" @input="updateValue"></chrome-picker>
```


## TODO
-[] docs
-[] more components


## License

vue-color is licensed under [The MIT License](LICENSE).

0 comments on commit e5db200

Please sign in to comment.