1.0.0 • Published 6 months ago

v-colopicker v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

colorpicker

A very beautiful color picker, supports input and output of multiple color formats, and supports gradient color selection.

Live Demo

中文文档

v-colopicker

Installation

yarn add v-colopicker

OR

npm install v-colopicker

How to use

The first step is global registration

import Vue3ColorPicker from "v-colopicker";
import "v-colopicker/style.css";

createApp(App)
  .use(router)
  .use(Vue3ColorPicker)
  .mount("#app");

OR

import { ColorPicker } from "v-colopicker";
import "v-colopicker/style.css";

export default defineComponent({
components: { ColorPicker },
});

Usage

<template>
  <div>
     <color-picker v-model:pureColor="pureColor" v-model:gradientColor="gradientColor"/>
  </div>
</template>
<script lang="ts">
  import { ref } from "vue";
  import { ColorInputWithoutInstance } from "tinycolor2";

  export default defineComponent({
     setup() {
       const pureColor = ref<ColorInputWithoutInstance>("red");
       const gradientColor = ref("linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 100%)");
       const gradientData = ref({});

       return { pureColor, gradientColor,gradientData }
     }
  });
</script>

Live Demo