├── .browserslistrc
├── .editorconfig
├── .eslintrc.js
├── .github
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ └── build.yml
├── .gitignore
├── .husky
└── pre-commit
├── LICENSE
├── README.md
├── bun.lockb
├── docs
├── .vitepress
│ ├── components
│ │ ├── InteractiveHomePageLayout.vue
│ │ └── examples
│ │ │ ├── Accessibility.vue
│ │ │ ├── Basic.vue
│ │ │ ├── NonCollapsingMode.vue
│ │ │ ├── NonPrimary.vue
│ │ │ └── Uncontrolled.vue
│ ├── config.mjs
│ └── theme
│ │ └── index.js
├── api.md
├── examples.md
├── guide
│ ├── faq.md
│ ├── getting-started.md
│ └── index.md
├── index.md
└── public
│ └── logo.png
├── examples
├── simple
│ ├── README.md
│ └── index.html
├── with-config
│ ├── .gitignore
│ ├── README.md
│ ├── index.html
│ ├── package.json
│ ├── public
│ │ └── favicon.ico
│ ├── src
│ │ ├── App.vue
│ │ └── main.js
│ └── vite.config.js
├── with-nuxt
│ ├── .gitignore
│ ├── README.md
│ ├── app.vue
│ ├── nuxt.config.ts
│ ├── package.json
│ ├── public
│ │ └── favicon.ico
│ ├── server
│ │ └── tsconfig.json
│ └── tsconfig.json
└── with-uncontrolled-component
│ ├── .gitignore
│ ├── README.md
│ ├── index.html
│ ├── package.json
│ ├── public
│ └── favicon.ico
│ ├── src
│ ├── App.vue
│ └── main.js
│ └── vite.config.js
├── favicon.ico
├── index.d.ts
├── index.html
├── package.json
├── prettier.config.js
├── screenshots
└── thumbnail.png
├── scripts
├── build.js
└── print-stats.js
├── src
├── App.vue
├── ColorPicker.vue
└── main.js
├── tests
└── unit
│ ├── __snapshots__
│ └── index.spec.js.snap
│ └── index.spec.js
└── vite.config.js
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 0.75%
2 | last 2 major versions
3 | not ie <= 11
4 | not dead
5 | not op_mini all
6 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | indent_size = 4
7 | indent_style = space
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | insert_final_newline = false
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true,
5 | },
6 | extends: ['plugin:vue/vue3-essential'],
7 | rules: {
8 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
9 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
10 | },
11 | };
12 |
--------------------------------------------------------------------------------
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, caste, color, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement.
63 | All complaints will be reviewed and investigated promptly and fairly.
64 |
65 | All community leaders are obligated to respect the privacy and security of the
66 | reporter of any incident.
67 |
68 | ## Enforcement Guidelines
69 |
70 | Community leaders will follow these Community Impact Guidelines in determining
71 | the consequences for any action they deem in violation of this Code of Conduct:
72 |
73 | ### 1. Correction
74 |
75 | **Community Impact**: Use of inappropriate language or other behavior deemed
76 | unprofessional or unwelcome in the community.
77 |
78 | **Consequence**: A private, written warning from community leaders, providing
79 | clarity around the nature of the violation and an explanation of why the
80 | behavior was inappropriate. A public apology may be requested.
81 |
82 | ### 2. Warning
83 |
84 | **Community Impact**: A violation through a single incident or series
85 | of actions.
86 |
87 | **Consequence**: A warning with consequences for continued behavior. No
88 | interaction with the people involved, including unsolicited interaction with
89 | those enforcing the Code of Conduct, for a specified period of time. This
90 | includes avoiding interactions in community spaces as well as external channels
91 | like social media. Violating these terms may lead to a temporary or
92 | permanent ban.
93 |
94 | ### 3. Temporary Ban
95 |
96 | **Community Impact**: A serious violation of community standards, including
97 | sustained inappropriate behavior.
98 |
99 | **Consequence**: A temporary ban from any sort of interaction or public
100 | communication with the community for a specified period of time. No public or
101 | private interaction with the people involved, including unsolicited interaction
102 | with those enforcing the Code of Conduct, is allowed during this period.
103 | Violating these terms may lead to a permanent ban.
104 |
105 | ### 4. Permanent Ban
106 |
107 | **Community Impact**: Demonstrating a pattern of violation of community
108 | standards, including sustained inappropriate behavior, harassment of an
109 | individual, or aggression toward or disparagement of classes of individuals.
110 |
111 | **Consequence**: A permanent ban from any sort of public interaction within
112 | the community.
113 |
114 | ## Attribution
115 |
116 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117 | version 2.1, available at
118 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
119 |
120 | Community Impact Guidelines were inspired by
121 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
122 |
123 | For answers to common questions about this code of conduct, see the FAQ at
124 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
125 | at [https://www.contributor-covenant.org/translations][translations].
126 |
127 | [homepage]: https://www.contributor-covenant.org
128 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
129 | [Mozilla CoC]: https://github.com/mozilla/diversity
130 | [FAQ]: https://www.contributor-covenant.org/faq
131 | [translations]: https://www.contributor-covenant.org/translations
132 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ## Contributing
2 |
3 | Contributions are **welcome** and will be fully **credited**.
4 |
5 | We accept contributions via Pull Requests on [Github](https://github.com/radial-color-picker/vue-color-picker).
6 |
7 | ## Pull Requests
8 |
9 | - **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
10 |
11 | - **Consider our release cycle** - We try to follow [SemVer](https://semver.org/). Randomly breaking public APIs is not an option.
12 |
13 | - **Create feature branches** - Don't ask us to pull from your main branch.
14 |
15 | - **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
16 |
17 | - **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
18 |
19 | **Happy coding**!
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/build.yml:
--------------------------------------------------------------------------------
1 | on:
2 | push:
3 | branches:
4 | - main
5 | workflow_dispatch:
6 |
7 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
8 | permissions:
9 | contents: read
10 | pages: write
11 | id-token: write
12 |
13 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
14 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
15 | concurrency:
16 | group: pages
17 | cancel-in-progress: false
18 |
19 | jobs:
20 | build:
21 | name: Code quality
22 | runs-on: ubuntu-latest
23 |
24 | steps:
25 | - uses: actions/checkout@v4
26 | - uses: oven-sh/setup-bun@v1
27 | - name: Install dependencies
28 | run: bun install
29 | - name: Build
30 | run: bun run build
31 | - name: Run linting
32 | run: bun run lint
33 | - name: Check Bundle Size
34 | run: bun run size-limit
35 | - name: Run tests
36 | run: bun run test:ci
37 | - name: Upload coverage to Codecov
38 | uses: codecov/codecov-action@v4
39 | with:
40 | token: ${{ secrets.CODECOV_TOKEN }}
41 | verbose: true
42 | - name: Setup Pages
43 | uses: actions/configure-pages@v4
44 | - name: Build with VitePress
45 | run: bun run docs:build
46 | - name: Upload artifact
47 | uses: actions/upload-pages-artifact@v3
48 | with:
49 | path: docs/.vitepress/dist
50 |
51 | deploy:
52 | environment:
53 | name: github-pages
54 | url: ${{ steps.deployment.outputs.page_url }}
55 | needs: build
56 | runs-on: ubuntu-latest
57 | name: Deploy
58 | steps:
59 | - name: Deploy to GitHub Pages
60 | id: deployment
61 | uses: actions/deploy-pages@v4
62 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | dist
4 | coverage
5 |
6 | # Log files
7 | npm-debug.log*
8 | yarn-debug.log*
9 | yarn-error.log*
10 |
11 | # Editor directories and files
12 | .idea
13 | .vscode
14 | *.suo
15 | *.ntvs*
16 | *.njsproj
17 | *.sln
18 |
19 | # vitepress folders
20 | .temp
21 | docs/.vitepress/cache
22 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | bun run lint-staged
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018-present, Rosen Kanev
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Radial Color Picker - Vue
2 |
3 |
19 |
20 | ## Introduction
21 |
22 | Great UX starts with two basic principles - ease of use and simplicity. Selecting a color should be as easy as moving a slider, clicking a checkbox or pressing a key just like other basic form elements behave.
23 |
24 | This is a flexible and minimalistic color picker. Developed with mobile devices and keyboard usage in mind. Key features:
25 |
26 | - Small size - 3.3 KB gzipped (JS and CSS combined)
27 | - Supports touch devices
28 | - Optimized animations
29 | - Ease of use
30 | - Screen reader support.
31 | - Tab to focus the picker.
32 | - ↑ or → arrow key to increase hue. PgUp to go quicker.
33 | - ↓ or ← arrow key to decrease hue. PgDown to go quicker.
34 | - Enter to select a color and close the picker or to open it.
35 | - Mouse ScrollUp to increase and ScrollDown to decrease hue (Opt-in).
36 | - TypeScript support
37 |
38 | ## Documentation
39 |
40 | You can find the documentation on the [website](https://radial-color-picker.github.io/vue-color-picker/).
41 | The documentation is divided into several sections:
42 |
43 | - [Getting Started](https://radial-color-picker.github.io/vue-color-picker/guide/getting-started.html)
44 | - [Examples](https://radial-color-picker.github.io/vue-color-picker/examples.html)
45 | - [Config Reference](https://radial-color-picker.github.io/vue-color-picker/api.html)
46 | - [First Asked Questions](https://radial-color-picker.github.io/vue-color-picker/guide/faq.html)
47 |
48 | ## Ecosystem
49 |
50 | The right color picker, but not the framework you're looking for?
51 |
52 | - [Vue][link-vue-color-picker] - you're here!
53 | - [React][link-react-color-picker]
54 | - [AngularJs][link-angularjs-color-picker]
55 | - [Angular][link-angular-color-picker]
56 |
57 | ## Demos
58 |
59 | - Basic Example - [Codepen](https://codepen.io/rkunev/pen/zjEmwV/)
60 | - Other Examples in the [docs](https://radial-color-picker.github.io/vue-color-picker/examples.html)
61 |
62 | ## Usage
63 |
64 | Color Picker on [npm](https://www.npmjs.com/package/@radial-color-picker/vue-color-picker)
65 |
66 | ```bash
67 | npm install @radial-color-picker/vue-color-picker
68 | ```
69 |
70 | And in your app:
71 |
72 | ```vue
73 |
74 |
75 |
76 |
77 |
101 | ```
102 |
103 | ## Change log
104 |
105 | Please see [Releases][link-releases] for more information on what has changed recently.
106 |
107 | ## Vue 3 and `@vue/compat`
108 |
109 | If your app isn't ready to upgrade to Vue 3 you can slowly transition via `@vue/compat` and the [instructions provided there](https://www.npmjs.com/package/@vue/compat). Once you're done you might notice a warning message - `ATTR_FALSE_VALUE`. This is intended behavior and you can optionally silence the warning with `configureCompat({ ATTR_FALSE_VALUE: false })`. When using Vue 3 without the compat layer the warning will go away too.
110 |
111 |
112 | Details
113 |
114 | [Vue warn]: (deprecation ATTR_FALSE_VALUE) Attribute "aria-disabled" with v-bind value `false` will render aria-disabled="false" instead of removing it in Vue 3. To remove the attribute, use `null` or `undefined` instead. If the usage is intended, you can disable the compat behavior and suppress this warning with:
115 | configureCompat({ ATTR_FALSE_VALUE: false })
116 | Details: https://v3.vuejs.org/guide/migration/attribute-coercion.html
117 | at <ColorPicker>
118 | at <App>
80 |
81 |
105 |
106 | ```
--------------------------------------------------------------------------------
/docs/guide/index.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | Great UX starts with two basic principles - ease of use and simplicity. Selecting a color should be as easy as moving a slider, clicking a checkbox or pressing a key just like other basic form elements behave.
4 |
5 | This is a flexible and minimalistic color picker. Developed with mobile devices and keyboard usage in mind.
6 |
7 | ## Features
8 |
9 | - Small size - 3.3 KB gzipped (JS and CSS combined)
10 | - Supports touch devices
11 | - Optimized animations
12 | - Ease of use
13 | - Screen reader support.
14 | - Tab to focus the picker.
15 | - ↑ or → arrow key to increase hue. PgUp to go quicker.
16 | - ↓ or ← arrow key to decrease hue. PgDown to go quicker.
17 | - Enter to select a color and close the picker or to open it.
18 | - Mouse ScrollUp to increase and ScrollDown to decrease hue (Opt-in).
19 | - TypeScript support
20 |
21 | ## Ecosystem
22 |
23 | The right color picker, but not the framework you're looking for?
24 |
25 | - [Vue](https://github.com/radial-color-picker/vue-color-picker) - you're here!
26 | - [React](https://github.com/radial-color-picker/react-color-picker)
27 | - [AngularJs](https://github.com/talamaska/angular-radial-color-picker)
28 | - [Angular](https://github.com/radial-color-picker/angular-color-picker)
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 |
4 | hero:
5 | name: 'Radial Color Picker'
6 | tagline: 'Minimalistic color picker with a focus on size, accessibility and performance.'
7 | actions:
8 | - theme: brand
9 | text: Get Started
10 | link: /guide/
11 | - theme: alt
12 | text: View on GitHub
13 | link: https://github.com/radial-color-picker/vue-color-picker
14 |
15 | features:
16 | - title: Small size
17 | details: Say no to web bloat! Sitting at 2.3 KB gzipped JS it's probably one of the smallest color pickers out there.
18 | - title: Ease of use
19 | details: Developed with mobile devices and keyboard usage in mind. Screen reader support.
20 | - title: Performant
21 | details: Highly tuned touch interactions to stay above 30fps on lower end mobile devices.
22 | ---
--------------------------------------------------------------------------------
/docs/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/radial-color-picker/vue-color-picker/76d7732df988effe04b8da6fe53b8aba934f7aa5/docs/public/logo.png
--------------------------------------------------------------------------------
/examples/simple/README.md:
--------------------------------------------------------------------------------
1 | # Example - UMD build (simple)
2 |
3 | This is a basic example of how to use `vue-color-picker` with the UMD build (useful for quick prototyping in the browser for example).
4 |
5 | ## How to use
6 |
7 | Download the example [or clone the whole project](https://github.com/radial-color-picker/vue-color-picker.git):
8 |
9 | ```bash
10 | curl https://codeload.github.com/radial-color-picker/vue-color-picker/tar.gz/main | tar -xz --strip=2 vue-color-picker-main/examples/simple
11 | cd simple
12 | ```
13 |
14 | ## Running the example
15 |
16 | Start an HTTP server with [`http-server`](https://www.npmjs.com/package/http-server), [`superstatic`](https://www.npmjs.com/package/superstatic) or if you prefer using Python follow [these instructions](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server) at MDN.
17 |
18 | ```bash
19 | # with http-server (starts the server on port 8000 and opens the default browser with the page)
20 | http-server -o
21 |
22 | # with superstatic (starts the server on port 3474)
23 | superstatic
24 | ```
--------------------------------------------------------------------------------
/examples/simple/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Radial Color Picker | Vue | Simple
6 |
7 |
8 |
9 |
10 |
14 |
47 |
48 |
49 |