├── .github └── workflows │ └── index.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .npmignore ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .vscode └── settings.json ├── CHANGELOG.md ├── README.md ├── commitlint.config.js ├── jsconfig.json ├── package.json ├── src ├── app.html ├── lib │ ├── components │ │ ├── Palette.svelte │ │ ├── PaletteCompactToggleButton.svelte │ │ ├── PaletteEyeDropperButton.svelte │ │ ├── PaletteIconButton.svelte │ │ ├── PaletteInput.svelte │ │ ├── PaletteLoader.svelte │ │ ├── PaletteSettingsButton.svelte │ │ ├── PaletteSettingsPanel.svelte │ │ ├── PaletteSlot.svelte │ │ ├── PaletteTools.svelte │ │ ├── PaletteTrashButton.svelte │ │ ├── __tests__ │ │ │ ├── Palette.test.js │ │ │ ├── PaletteCompactToggleButton.test.js │ │ │ ├── PaletteEyeDropperButton.test.js │ │ │ ├── PaletteIconButton.test.js │ │ │ ├── PaletteInput.test.js │ │ │ └── PaletteSlot.test.js │ │ ├── icons │ │ │ ├── CompactIcon.svelte │ │ │ ├── EnlargeIcon.svelte │ │ │ ├── EyeDropperIcon.svelte │ │ │ ├── PlusIcon.svelte │ │ │ ├── SettingsIcon.svelte │ │ │ └── TrashIcon.svelte │ │ └── useDeletion.js │ ├── enums │ │ ├── PaletteDeletionMode.js │ │ ├── PaletteEvent.js │ │ ├── PaletteIcon.js │ │ └── PaletteTool.js │ ├── index.js │ └── utils │ │ ├── __tests__ │ │ └── utils.test.js │ │ └── utils.js └── routes │ ├── +layout.svelte │ ├── +page.js │ ├── example1 │ └── +page.svelte │ ├── example2 │ └── +page.svelte │ ├── example3 │ └── +page.svelte │ └── example4 │ └── +page.svelte ├── static ├── app.css └── favicon.png ├── svelte.config.js ├── vite.config.js ├── vitest.config.js ├── vitest.setup.js └── yarn.lock /.github/workflows/index.yml: -------------------------------------------------------------------------------- 1 | name: 'deploy' 2 | on: 3 | push: 4 | branches: 5 | - main 6 | - beta 7 | jobs: 8 | release: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | - uses: actions/setup-node@v4 13 | with: 14 | node-version: 20 15 | - run: yarn install 16 | - run: yarn test:ci 17 | - run: yarn build 18 | - run: npx semantic-release 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} 21 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 22 | - uses: codecov/codecov-action@v4 23 | with: 24 | directory: ./coverage/ 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build 2 | /build 3 | /dist 4 | /package 5 | /.svelte-kit 6 | 7 | # Env 8 | .env 9 | .env.* 10 | 11 | # Misc 12 | .DS_STORE 13 | 14 | # Dependencies 15 | npm-debug.log* 16 | yarn-debug.log* 17 | yarn-error.log* 18 | package-lock.json 19 | .yarn 20 | /node_modules 21 | 22 | # Webstorm 23 | /.idea 24 | *.iml 25 | 26 | # Tests 27 | /coverage 28 | /__snapshots__ -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit $1 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | . "$(dirname -- "$0")/_/husky.sh" 3 | 4 | yarn test:ci && yarn format 5 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | *.test.js -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | engine-strict=true 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Build 2 | /dist 3 | /.svelte-kit 4 | 5 | # Misc 6 | .DS_STORE 7 | .husky 8 | 9 | # Dependencies 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | /node_modules 14 | 15 | # IDE 16 | /.idea 17 | /.vscode 18 | 19 | # Tests 20 | /coverage 21 | /__snapshots__ -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "useTabs": true, 4 | "tabWidth": 4, 5 | "singleQuote": true, 6 | "semi": false, 7 | "trailingComma": "es5", 8 | "bracketSpacing": true, 9 | "bracketSameLine": false, 10 | "plugins": ["prettier-plugin-svelte"], 11 | "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] 12 | } 13 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "todo-tree.tree.showBadges": false 3 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [4.1.0](https://github.com/untemps/svelte-palette/compare/v4.0.0...v4.1.0) (2024-02-29) 2 | 3 | ### Features 4 | 5 | - Allow to name colors ([#95](https://github.com/untemps/svelte-palette/issues/95)) ([f707306](https://github.com/untemps/svelte-palette/commit/f7073066eeef159714cee86e5f4bbad301590d0f)) 6 | 7 | # [4.0.0](https://github.com/untemps/svelte-palette/compare/v3.0.1...v4.0.0) (2023-12-09) 8 | 9 | ### Features 10 | 11 | - Refactor codebase and add cool new features ([9c40860](https://github.com/untemps/svelte-palette/commit/9c40860de2457d61bc58a135a3524e0c4734eb37)) 12 | 13 | ### BREAKING CHANGES 14 | 15 | - - Change default layout 16 | - Rename transparent slot 17 | - Remove allowDeletion prop 18 | 19 | # [4.0.0-beta.2](https://github.com/untemps/svelte-palette/compare/v4.0.0-beta.1...v4.0.0-beta.2) (2023-12-05) 20 | 21 | ### Bug Fixes 22 | 23 | - Fix colors calculation with non-array input ([#83](https://github.com/untemps/svelte-palette/issues/83)) ([ed24a36](https://github.com/untemps/svelte-palette/commit/ed24a36f8e5c26088cdecc2b957dab168111d0db)) 24 | 25 | # [4.0.0-beta.1](https://github.com/untemps/svelte-palette/compare/v3.0.1...v4.0.0-beta.1) (2023-12-03) 26 | 27 | ### Features 28 | 29 | - Refactor codebase and add cool new features ([#83](https://github.com/untemps/svelte-palette/issues/83)) ([2d9dcdc](https://github.com/untemps/svelte-palette/commit/2d9dcdc6ea815a487f816e5fd824bfd2313ac0bb)) 30 | 31 | ### BREAKING CHANGES 32 | 33 | - - Chang default layout 34 | - Rename transparent slot 35 | - Remove allowDeletion prop 36 | 37 | ## [3.0.1](https://github.com/untemps/svelte-palette/compare/v3.0.0...v3.0.1) (2023-09-29) 38 | 39 | # [3.0.0](https://github.com/untemps/svelte-palette/compare/v2.4.1...v3.0.0) (2023-09-27) 40 | 41 | ### chore 42 | 43 | - Upgrade to Svelte 4 ([#75](https://github.com/untemps/svelte-palette/issues/75)) ([4fab7aa](https://github.com/untemps/svelte-palette/commit/4fab7aa5eec09ce1b7a783bcdc7759c4bd802c98)) 44 | 45 | ### BREAKING CHANGES 46 | 47 | - No more cjs build and Node 18+ upgrade 48 | 49 | ## [2.4.1](https://github.com/untemps/svelte-palette/compare/v2.4.0...v2.4.1) (2023-04-26) 50 | 51 | ### Bug Fixes 52 | 53 | - Remove useless z-index ([#68](https://github.com/untemps/svelte-palette/issues/68)) ([4516172](https://github.com/untemps/svelte-palette/commit/451617225f239138eebe4acb242cf578effca961)) 54 | 55 | # [2.4.0](https://github.com/untemps/svelte-palette/compare/v2.3.1...v2.4.0) (2023-04-18) 56 | 57 | ### Features 58 | 59 | - Add support for async colors prop ([#67](https://github.com/untemps/svelte-palette/issues/67)) ([6415080](https://github.com/untemps/svelte-palette/commit/64150800dadac4d251b8afa269d752ec22b3c24c)) 60 | 61 | ## [2.3.1](https://github.com/untemps/svelte-palette/compare/v2.3.0...v2.3.1) (2023-03-19) 62 | 63 | ### Bug Fixes 64 | 65 | - Fix SvelteKit support ([#65](https://github.com/untemps/svelte-palette/issues/65)) ([5c25993](https://github.com/untemps/svelte-palette/commit/5c259932f9c293a32a6ee2856b4da1e649aa4ee9)) 66 | 67 | # [2.3.0](https://github.com/untemps/svelte-palette/compare/v2.2.0...v2.3.0) (2023-03-17) 68 | 69 | ### Features 70 | 71 | - Drill component values into slots ([#64](https://github.com/untemps/svelte-palette/issues/64)) ([de41cc6](https://github.com/untemps/svelte-palette/commit/de41cc6ce4d63c32ef58978c98a79b95fd0253dd)) 72 | 73 | # [2.2.0](https://github.com/untemps/svelte-palette/compare/v2.1.0...v2.2.0) (2023-03-13) 74 | 75 | ### Features 76 | 77 | - Add transition prop ([#61](https://github.com/untemps/svelte-palette/issues/61)) ([345fdcc](https://github.com/untemps/svelte-palette/commit/345fdcce1486200cc5b3f550da47cb2b64738c11)) 78 | 79 | # [2.1.0](https://github.com/untemps/svelte-palette/compare/v2.0.0...v2.1.0) (2023-03-11) 80 | 81 | ### Features 82 | 83 | - Add numColumns prop ([#60](https://github.com/untemps/svelte-palette/issues/60)) ([b2f6dd9](https://github.com/untemps/svelte-palette/commit/b2f6dd99c7bcf2af358a89dc76a2e2af9391aed4)) 84 | 85 | # [2.0.0](https://github.com/untemps/svelte-palette/compare/v1.9.2...v2.0.0) (2023-02-27) 86 | 87 | ### Features 88 | 89 | - Add compact mode ([#59](https://github.com/untemps/svelte-palette/issues/59)) ([966c540](https://github.com/untemps/svelte-palette/commit/966c54026c109bdbf5f9a546425597231b9510f5)) 90 | 91 | ### BREAKING CHANGES 92 | 93 | - Some imports have been renamed 94 | 95 | ## [1.9.2](https://github.com/untemps/svelte-palette/compare/v1.9.1...v1.9.2) (2022-10-07) 96 | 97 | ## [1.9.1](https://github.com/untemps/svelte-palette/compare/v1.9.0...v1.9.1) (2022-10-05) 98 | 99 | ### Bug Fixes 100 | 101 | - Fix distribution config and deletionMode update ([#47](https://github.com/untemps/svelte-palette/issues/47)) ([091f437](https://github.com/untemps/svelte-palette/commit/091f4376dd32d651b9e06f59261f3e41f8e63a6a)) 102 | 103 | ## [1.9.1-beta.3](https://github.com/untemps/svelte-palette/compare/v1.9.1-beta.2...v1.9.1-beta.3) (2022-10-04) 104 | 105 | ### Bug Fixes 106 | 107 | - Fix deletion mode update ([842c1b6](https://github.com/untemps/svelte-palette/commit/842c1b66f6bcc85c5732ae7aae4642b1fdaf3689)) 108 | 109 | ## [1.9.1-beta.2](https://github.com/untemps/svelte-palette/compare/v1.9.1-beta.1...v1.9.1-beta.2) (2022-10-04) 110 | 111 | ## [1.9.1-beta.1](https://github.com/untemps/svelte-palette/compare/v1.9.0...v1.9.1-beta.1) (2022-10-04) 112 | 113 | # [1.9.0](https://github.com/untemps/svelte-palette/compare/v1.8.2...v1.9.0) (2022-09-29) 114 | 115 | ### Features 116 | 117 | - Add new deletionMode prop ([#46](https://github.com/untemps/svelte-palette/issues/46)) ([2bc0e3f](https://github.com/untemps/svelte-palette/commit/2bc0e3f263905766a550a5fd596e182023de8c7f)) 118 | 119 | ## [1.8.2](https://github.com/untemps/svelte-palette/compare/v1.8.1...v1.8.2) (2022-06-06) 120 | 121 | ### Bug Fixes 122 | 123 | - Prevent from multiple enter event subscriptions on slots ([#31](https://github.com/untemps/svelte-palette/issues/31)) ([429d7ad](https://github.com/untemps/svelte-palette/commit/429d7add9f9b52fa1c401a061a01a93aad0393ab)) 124 | 125 | ## [1.8.1](https://github.com/untemps/svelte-palette/compare/v1.8.0...v1.8.1) (2022-06-05) 126 | 127 | ### Bug Fixes 128 | 129 | - Remove duplicates on allowDuplicates update ([#29](https://github.com/untemps/svelte-palette/issues/29)) ([3fdad78](https://github.com/untemps/svelte-palette/commit/3fdad78e21da70cd92b97f1215ea97415bf532b1)) 130 | 131 | # [1.8.0](https://github.com/untemps/svelte-palette/compare/v1.7.0...v1.8.0) (2022-06-03) 132 | 133 | ### Features 134 | 135 | - Add inputType prop ([#26](https://github.com/untemps/svelte-palette/issues/26)) ([d9d8179](https://github.com/untemps/svelte-palette/commit/d9d81790f4e131afc5886370268b2aa5790fe6a5)) 136 | 137 | # [1.7.0](https://github.com/untemps/svelte-palette/compare/v1.6.2...v1.7.0) (2022-05-28) 138 | 139 | ### Features 140 | 141 | - Implement EyeDropper API ([#24](https://github.com/untemps/svelte-palette/issues/24)) ([34b4751](https://github.com/untemps/svelte-palette/commit/34b47518c779f28949d70d15ca473e4a2e9a7ce3)) 142 | 143 | ## [1.6.2](https://github.com/untemps/svelte-palette/compare/v1.6.1...v1.6.2) (2022-02-11) 144 | 145 | ## [1.6.1](https://github.com/untemps/svelte-palette/compare/v1.6.0...v1.6.1) (2022-01-11) 146 | 147 | ### Bug Fixes 148 | 149 | - Wait for tooltip content to exist or be added ([#19](https://github.com/untemps/svelte-palette/issues/19)) ([a56714a](https://github.com/untemps/svelte-palette/commit/a56714a3516d34688b4b2cc4a55116885f4b46b7)) 150 | 151 | # [1.6.0](https://github.com/untemps/svelte-palette/compare/v1.5.1...v1.6.0) (2022-01-04) 152 | 153 | ### Features 154 | 155 | - Close tooltip after clicking content ([ec11fc0](https://github.com/untemps/svelte-palette/commit/ec11fc0d36b535f03ab98646aaeb903d782722f8)) 156 | 157 | ## [1.5.1](https://github.com/untemps/svelte-palette/compare/v1.5.0...v1.5.1) (2021-12-19) 158 | 159 | ### Bug Fixes 160 | 161 | - Fix color addition when maxColors is updated ([9bd324e](https://github.com/untemps/svelte-palette/commit/9bd324e8382c981c46f616e7042897ef91f5a9ab)) 162 | 163 | # [1.5.0](https://github.com/untemps/svelte-palette/compare/v1.4.3...v1.5.0) (2021-12-18) 164 | 165 | ### Bug Fixes 166 | 167 | - Fix palette css ([b377ab4](https://github.com/untemps/svelte-palette/commit/b377ab4caaeaaf80f77f6b4ca5e4ad8333c46d37)) 168 | 169 | ### Features 170 | 171 | - Allow to pass custom element as deletion tooltip content ([f72cd49](https://github.com/untemps/svelte-palette/commit/f72cd490852440c4f56b2269e1d1045c8d5ad1ac)) 172 | - Allow to set a custom class to deletion tooltip root element ([04a21a2](https://github.com/untemps/svelte-palette/commit/04a21a2dc5bfbcf40f397a1aa13aa77afff2ffa7)) 173 | - Allow to trigger callbacks with custom params from deletion tooltip content elements ([a91b534](https://github.com/untemps/svelte-palette/commit/a91b53404e9a10b4a65cca8f1414109071e8bed5)) 174 | 175 | ## [1.4.3](https://github.com/untemps/svelte-palette/compare/v1.4.2...v1.4.3) (2021-12-12) 176 | 177 | ### Bug Fixes 178 | 179 | - Fix first-run tooltip display ([efb115e](https://github.com/untemps/svelte-palette/commit/efb115e1daa2bb10bf2e42145e990df849c3875d)) 180 | 181 | ## [1.4.3](https://github.com/untemps/svelte-palette/compare/v1.4.2...v1.4.3) (2021-12-12) 182 | 183 | ### Bug Fixes 184 | 185 | - Fix first-run tooltip display ([efb115e](https://github.com/untemps/svelte-palette/commit/efb115e1daa2bb10bf2e42145e990df849c3875d)) 186 | 187 | ## [1.4.2](https://github.com/untemps/svelte-palette/compare/v1.4.1...v1.4.2) (2021-12-07) 188 | 189 | ## [1.4.1](https://github.com/untemps/svelte-palette/compare/v1.4.0...v1.4.1) (2021-12-06) 190 | 191 | ### Bug Fixes 192 | 193 | - Remove tooltip template earlier to prevent it from flashing ([#12](https://github.com/untemps/svelte-palette/issues/12)) ([dff176a](https://github.com/untemps/svelte-palette/commit/dff176a0edd54b4cc91b1a6175b81cbd330b5e59)) 194 | 195 | # [1.4.0](https://github.com/untemps/svelte-palette/compare/v1.3.0...v1.4.0) (2021-12-06) 196 | 197 | ### Features 198 | 199 | - Add slots for header and footer dividers ([#9](https://github.com/untemps/svelte-palette/issues/9)) ([04caea5](https://github.com/untemps/svelte-palette/commit/04caea57ff85ad6c806ece30382b04779be61f91)) 200 | 201 | # [1.3.0](https://github.com/untemps/svelte-palette/compare/v1.2.1...v1.3.0) (2021-12-06) 202 | 203 | ### Features 204 | 205 | - Pass class down to root tag ([#10](https://github.com/untemps/svelte-palette/issues/10)) ([210ded2](https://github.com/untemps/svelte-palette/commit/210ded27e4e3724317753e746ac028eecc305544)) 206 | 207 | ## [1.2.1](https://github.com/untemps/svelte-palette/compare/v1.2.0...v1.2.1) (2021-12-03) 208 | 209 | ### Bug Fixes 210 | 211 | - Fix selected color management to preserve selection outside of slot focus ([#7](https://github.com/untemps/svelte-palette/issues/7)) ([68df37a](https://github.com/untemps/svelte-palette/commit/68df37af345d94f3a0e499da3ec6ae0aae681ed7)) 212 | 213 | # [1.2.0](https://github.com/untemps/svelte-palette/compare/v1.1.0...v1.2.0) (2021-12-03) 214 | 215 | ### Features 216 | 217 | - Add a maxColors prop to limit the number of slots in the palette ([#6](https://github.com/untemps/svelte-palette/issues/6)) ([48671f8](https://github.com/untemps/svelte-palette/commit/48671f8e6e09c1d165964cfd09fe1ff374fa588b)) 218 | 219 | # [1.1.0](https://github.com/untemps/svelte-palette/compare/v1.0.1...v1.1.0) (2021-12-03) 220 | 221 | ### Features 222 | 223 | - Allow to display a transparent slot at the end of the list ([#5](https://github.com/untemps/svelte-palette/issues/5)) ([90f3233](https://github.com/untemps/svelte-palette/commit/90f32336b828f0dd2933c2901ea4da3c7feb0698)) 224 | 225 | ## [1.0.1](https://github.com/untemps/svelte-palette/compare/v1.0.0...v1.0.1) (2021-11-13) 226 | 227 | ### Bug Fixes 228 | 229 | - Delete slots by index instead of color ([#2](https://github.com/untemps/svelte-palette/issues/2)) ([b03c263](https://github.com/untemps/svelte-palette/commit/b03c26374e32710c2df54376584915a16018fe29)) 230 | 231 | # 1.0.0 (2021-11-07) 232 | 233 | ### Features 234 | 235 | - Add flag to allow deletion ([4c46206](https://github.com/untemps/svelte-palette/commit/4c46206b6a989fca59476ab6f056b55b50068aef)) 236 | - Add flag to allow duplicates ([47418dc](https://github.com/untemps/svelte-palette/commit/47418dc7feab30ad9cfd7df34dca7c87b99f1ceb)) 237 | - Add transition on slot appearance ([8beab34](https://github.com/untemps/svelte-palette/commit/8beab34ba5beea2b48d4bc1072e34eecfeb98cbc)) 238 | - Allow color deletion via a tooltip ([62e95dc](https://github.com/untemps/svelte-palette/commit/62e95dc84096fa1acbb009191e95591992be4af2)) 239 | - Change palette slot root component into button ([8d1dbb8](https://github.com/untemps/svelte-palette/commit/8d1dbb8ac621248c9162429a87ce236c725f0870)) 240 | - Expose Palette parts as slots ([5b32c5f](https://github.com/untemps/svelte-palette/commit/5b32c5fd384c05c45c81338b4bd4f3c92600ccac)) 241 | - Expose Palette selection event ([1a72764](https://github.com/untemps/svelte-palette/commit/1a727641389e6974146d8cf795cb0f26cdf32775)) 242 | - Improve palette input ([6d391f3](https://github.com/untemps/svelte-palette/commit/6d391f344e2f5bc5d58841142e6c6a1c9f0c0da6)) 243 | - Initial commit ([ab80562](https://github.com/untemps/svelte-palette/commit/ab80562e9e0170964490d2cee7fe459b83dacd3b)) 244 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
5 | Svelte component to display a customisable color picker 6 |
7 | 8 | --- 9 | 10 | [](https://www.npmjs.com/package/@untemps/svelte-palette) 11 | [](https://github.com/untemps/svelte-palette/actions) 12 | [](https://codecov.io/gh/untemps/svelte-palette) 13 | 14 | ## Demo 15 | 16 |17 | :red_circle: LIVE 18 | DEMO :red_circle: 19 |
20 | 21 | ## Installation 22 | 23 | ```bash 24 | yarn add @untemps/svelte-palette 25 | ``` 26 | 27 | ## Usage 28 | 29 | ### Basic Usage 30 | 31 | ```html 32 | 45 | 46 |Loading...
339 |