Vue Color Kit is a dedicated component library providing a highly customizable color picker for Vue 3 applications. Currently stable at version 1.0.6, it offers both dark and light themes, supports various color formats (HEX, RGBA), and includes features like a color history palette and an optional 'sucker' tool for picking colors directly from the screen. While its release cadence appears to be infrequent, with recent updates focusing on minor improvements, it serves as a lightweight and focused solution for integrating color selection capabilities into Vue 3 projects. Its key differentiators include native Vue 3 support, minimal dependencies, and a direct approach to color picking without relying on external UI frameworks, offering a straightforward developer experience for basic to moderately complex color input requirements.
npm install vue-color-kitVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to integrate the ColorPicker component, bind its value, and handle color changes within a Vue 3 Composition API setup, including the necessary CSS import. It also shows the basic event handling for the 'sucker' tool.
Add `import 'vue-color-kit/dist/vue-color-kit.css'` to your main application file (e.g., `main.ts` or `main.js`) or the component where `ColorPicker` is used.
Implement the logic within the `@openSucker` event handler to dynamically create and manage a canvas element, setting `sucker-canvas` to the created element and `sucker-area` to the desired capture coordinates. Remember to clean up the canvas when the tool closes.
Access the specific color format required from the event object, for example: `const { r, g, b, a } = color.rgba; this.color = `rgba(${r}, ${g}, ${b}, ${a})`;`Ensure you have `import { ColorPicker } from 'vue-color-kit';` and included `ColorPicker` in the `components` option of your Vue component (e.g., `components: { ColorPicker }`).Add `import 'vue-color-kit/dist/vue-color-kit.css'` to your application's entry file (e.g., `main.js`/`main.ts`) or within the `<script>` section of the Vue component where `ColorPicker` is used.
Implement the `openSucker` event handler to dynamically create an `HTMLCanvasElement` and set it to the `sucker-canvas` prop, along with defining the capture region in `sucker-area`. Remember to clean up the canvas when the sucker tool is closed.