# GradientPicker API
# es6 style
import '@easylogic/colorpicker/dist/colorpicker.css';
import ColorPickerUI from '@easylogic/colorpicker'
const radientPicker = ColorPickerUI.createGradientPicker({
position: "inline",
container: this.refs.$color.el,
gradient: 'linear-gradient(to right, white 0%, black 100%)',
onChange: (gradientString) => {
console.log(gradientString);
}
});
// set value
gradientPicker.setValue('radial-gradient(circle, white 0%, black 100%'));
// get value
var gradientString = gradientPicker.getValue()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# show GradientPicker
gradientPicker.show({
left : pos.left,
top : pos.bottom,
hideDelay : 2000 // 컬러피커가 열렸다가 숨겨질 타이밍을 지정합니다. 기본값은 2000 (2초)
})
1
2
3
4
5
2
3
4
5
# setValue
gradientPicker.setValue('linear-gradient(to right, red 10%, white 100%)')
1
# getValue
gradientPicker.getValue() // return linear-gradient(....)
1