1.1.53 • Published 5 years ago

color-pallate-react v1.1.53

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

color-pallate-react

To apply the color(There are 2 types of pallates) This library is small example of how selected color from color-pallate and it returns the selected Color.

NPM JavaScript Style Guide

Install

npm install --save color-pallate-react 
or
yarn add color-pallate-react

Props

PROPNAME           PROPTYPE

setColorPallate    funtion 
selectedIndex      number 
height             number
width              number
padding            number
borderRadius       number

Pallate-1

import React, { Component } from 'react'

import ExampleComponent from 'color-pallate-react'

export default class App extends Component {
  constructor(props){
    super(props)
    this.state={
      colorSelected:'',
      selectedIndex:0,
      colours:[{color: '#98AAB3', isSelect: false},
      {color: '#8F7EE6', isSelect: false},
      {color: '#00AAFF', isSelect: false},
      {color: '#30BFBF', isSelect: false},
      {color: '#47CC8A', isSelect: false},
      {color: '#8ACC47', isSelect: false},
      {color: '#FFD500', isSelect: false},
      {color: '#FF9F1A', isSelect: false}
    ]
    }
  }

 setColorPallate =(color,index)=> {
   this.setState({colorSelected:color,selectedIndex:index})
   console.log("selected Color",color)
  };

  render () {
    console.log("the color and index are --",this.state.colorSelected,this.state.selectedIndex)//to see the output
    return (
      <div>
        //  If props are not sent then default props are sent
         <ExampleComponent setColorPallate={this.setColorPallate} />
        // If props are sent
         <ExampleComponent setColorPallate={this.setColorPallate} height={7} width={7} padding={15} borderRadius={20} selectedIndex={this.state.selectedIndex} colours={this.state.colours}/>
      </div>
    )
  }
}

Props

PROPNAME           PROPTYPE

setColorPallate    funtion 
selectedIndex      number 

Pallate-2

import React, { Component } from 'react'

import {CheckColorPallate} from 'color-pallate-react'

export default class Pallate extends Component {
  constructor(props){
    super(props)
    this.state={
     colorSelected:'',
      selectedIndex:0
    }
  }

  setColorPallate =(color,index)=> {
   this.setState({colorSelected:color,selectedIndex:index})
   console.log("selected Color",color)
  };

  render () {
    console.log("the color and index are --",this.state.colorSelected,this.state.selectedIndex)//to see the output
    return (
      <div>
        <CheckColorPallate setColorPallate={this.setColorPallate} selectedIndex={this.state.selectedIndex}/>
      </div>
    )
  }
}

License

MIT © RituAnand

1.1.53

5 years ago

1.0.53

5 years ago

1.0.52

5 years ago

1.0.51

5 years ago

1.0.50

5 years ago

1.0.49

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.44

5 years ago

1.0.43

5 years ago

1.0.42

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago