feat(toolbar): add color picker that copies the picked color - #514
Draft
aidenybai wants to merge 1 commit into
Draft
feat(toolbar): add color picker that copies the picked color#514aidenybai wants to merge 1 commit into
aidenybai wants to merge 1 commit into
Conversation
Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a color picker (eyedropper) action to the toolbar. Clicking it opens the browser's native eyedropper, and the picked color is copied to the clipboard with brief in-toolbar feedback showing a swatch and the copied hex value.
Behavior
EyeDropperoverlay so the user can sample any pixel on the page.#1A2B3C) via the existingcopyContentutil, reusing its multi-format clipboard handling.Copied #RRGGBBand the icon is highlighted as confirmation.EyeDropperAPI is supported (Chromium-based browsers), so it never shows as a no-op in Firefox/Safari.Implementation notes
src/components/icons/icon-eyedropper.tsx— new filled SVG icon, consistent with the existing icon components.src/utils/is-eyedropper-supported.ts— small feature-detection util (one utility per file).src/types.ts— global ambient declaration for theEyeDropperbrowser API.src/constants.ts—COLOR_PICKER_ACTION_IDandCOLOR_PICK_FEEDBACK_DURATION_MS.src/components/toolbar/index.tsx— handler + button wiring, picked-color signal, and feedback tooltip.Testing
e2e/toolbar-color-picker.spec.tsstubs theEyeDropperAPI and verifies the button renders, the picked color is written to the clipboard, and selection mode is not entered.pnpm build,pnpm typecheck, andpnpm lintpass.Summary by cubic
Adds a Pick color action to the toolbar using the native EyeDropper API. It copies the selected color to the clipboard and shows brief in-toolbar confirmation.
#1A2B3C) via existingcopyContent.Written for commit 0fd3632. Summary will update on new commits.