Skip to content

Feat(UI): Add linear and radial gradient tools to canvas#8774

Merged
lstein merged 19 commits intoinvoke-ai:mainfrom
DustyShoe:Feat(UI)/Canvas/Add_gradient_tool
Feb 3, 2026
Merged

Feat(UI): Add linear and radial gradient tools to canvas#8774
lstein merged 19 commits intoinvoke-ai:mainfrom
DustyShoe:Feat(UI)/Canvas/Add_gradient_tool

Conversation

@DustyShoe
Copy link
Copy Markdown
Collaborator

@DustyShoe DustyShoe commented Jan 18, 2026

Summary

This PR adds a set of radial and linear gradients to available toolset on canvas.
Adds parent and child custom buttons.
Tool respects color transparency and both color swatches. It draws gradient in direction of mouse movement: from active color to inactive. Gradient is rasterized on mouse release on current active layer.
It is also possible to activate clipping by drag start-stop points.
Gradient is clipped by bbox to save on performance.

2026-01-18.16-30-16.mp4

Related Issues / Discussions

QA Instructions

  • Verify buttons display is correct.
  • Verify gradient direction follows mouse movement from active color to inactive color.
  • Change both color swatches and confirm both are used in the gradient.
  • Set opacity on one or both colors and verify transparency is respected.
  • Draw gradients of different sizes and confirm rendering is clipped to the bounding box.
  • Activate "Clip Gradient" and verify clip by start-end points is applied.
  • Use Undo/Redo and verify each gradient application is a single history step.

Merge Plan

PR merge should be painless. Though, code might need a proper check.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@github-actions github-actions bot added the frontend PRs that change frontend files label Jan 18, 2026
@DustyShoe
Copy link
Copy Markdown
Collaborator Author

Also would like an advise on what icon should "Gradient Clip" button have.
Right now it uses "Crop" icon:
image

@lstein
Copy link
Copy Markdown
Collaborator

lstein commented Jan 20, 2026

@dunkeroni Could you take primary reviewer on this one?

@DustyShoe DustyShoe marked this pull request as ready for review January 21, 2026 15:48
Copy link
Copy Markdown
Collaborator

@dunkeroni dunkeroni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a useful tool. Operating it is a bit clunky, but mostly because interacting with both colors on our color-picker is tedious right now.

Performance-wise it seems pretty good on my system; drawing is done on the user end and committed on release. Drawing many gradients quickly will slow down the UI a lot, but that is a limitation of the rasterization/update of the layer on the server, not a flaw that this PR can solve.

DustyShoe and others added 7 commits January 26, 2026 08:29
…bject/CanvasObjectGradient.ts

Co-authored-by: dunkeroni <dunkeroni@gmail.com>
…ol/ToolGradientButton.tsx

Co-authored-by: dunkeroni <dunkeroni@gmail.com>
…ol/ToolGradientButton.tsx

Co-authored-by: dunkeroni <dunkeroni@gmail.com>
…ol/ToolGradientButton.tsx

Co-authored-by: dunkeroni <dunkeroni@gmail.com>
@lstein lstein added the v6.12.0 Intended for 6.12.0 release label Jan 29, 2026
@dunkeroni
Copy link
Copy Markdown
Collaborator

I was having some inconsistencies getting the mode popover to show when I wanted it. Instead I've moved them up to the top left next to the clip toggle, so they're always visible.

image

Can you add me as a collaborator to your fork so that I can push commits here? Something about how git handles permissions when the repos have been touched by LFS makes it impossible for me right now.

@DustyShoe
Copy link
Copy Markdown
Collaborator Author

DustyShoe commented Feb 3, 2026

Instead I've moved them up to the top left next to the clip toggle, so they're always visible.

That was my initial idea, but it was suggested to use popover instead in https://discord.com/channels/1020123559063990373/1457030215686422569. So i thought i'd reuse this suggestion here.

Can you add me as a collaborator to your fork so that I can push commits here?

I couldn't figure out how to do that. Some searches claim that you can not do that.

@DustyShoe
Copy link
Copy Markdown
Collaborator Author

DustyShoe commented Feb 3, 2026

TBH I like the child set of icons and will investigate the issue with inconsistent rendering.
If i won't figure it out we'll get back to top positioned buttons.

@dunkeroni
Copy link
Copy Markdown
Collaborator

Having settings at the top makes it consistent with the current brush tools, and would be a good pattern to follow with future tools as well. It doesn't obstruct the canvas view at all either.

@DustyShoe
Copy link
Copy Markdown
Collaborator Author

Having settings at the top makes it consistent with the current brush tools, and would be a good pattern to follow with future tools as well. It doesn't obstruct the canvas view at all either.

Cool! Let's keep it in top bar then. Can you push your change now or it is still blocking?

@dunkeroni
Copy link
Copy Markdown
Collaborator

No, you'd have to go to the settings on your own fork and send me an invite to be a collaborator.

Otherwise, if you just want to merge them into this branch yourself, I pushed the edits to my own fork at https://github.com/dunkeroni/InvokeAI/tree/Feat(UI)/Canvas/Add_gradient_tool

Copy link
Copy Markdown
Collaborator

@dunkeroni dunkeroni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected and adds an otherwise difficult to achieve effect. UI impact is minimal, and the structure can easily extend for new behaviors in the future if someone wants to add.

@lstein lstein enabled auto-merge (squash) February 3, 2026 20:18
@lstein lstein merged commit b7d7cd0 into invoke-ai:main Feb 3, 2026
13 checks passed
danielteeny added a commit to danielteeny/InvokeAI that referenced this pull request Feb 4, 2026
Merged upstream features:
- Gradient tools (invoke-ai#8774)
- Paged gallery view (invoke-ai#8772)
- Encoder CPU toggle (invoke-ai#8777)
- Various bug fixes

Removed downstream pagination implementation in favor of upstream:
- Deleted PaginatedGrid.tsx
- Deleted GalleryModeCombobox.tsx
- Deleted PageSizeCombobox.tsx
- Removed galleryMode, paginationPageSize, currentPage from gallery state
- Updated GallerySettingsPopover to use upstream's UsePagedGalleryViewCheckbox

Kept downstream features:
- LoRA category system
- Folder hierarchy (recursiveFolderView)
- Layout mode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend PRs that change frontend files v6.12.0 Intended for 6.12.0 release

Projects

Status: 6.12.x

Development

Successfully merging this pull request may close these issues.

3 participants