Skip to content

New nodes: Colors to Gradient, Flatten Color, and Flatten Gradient#3835

Merged
Keavon merged 3 commits intomasterfrom
gradient-nodes
Feb 26, 2026
Merged

New nodes: Colors to Gradient, Flatten Color, and Flatten Gradient#3835
Keavon merged 3 commits intomasterfrom
gradient-nodes

Conversation

@Keavon
Copy link
Member

@Keavon Keavon commented Feb 26, 2026

Closes #2875 in the simple case, but doesn't yet support assigning stop or midpoint positions which will probably need to wait on #1832 to be done ergonomically.

image image

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Keavon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the graphic node system by providing robust mechanisms for handling color and gradient data. It introduces core flattening functionalities within the graphic-types library to isolate color and gradient elements from complex graphic tables. These capabilities are then exposed as new nodes in the node graph, alongside a utility node to convert a collection of colors into a gradient, offering greater flexibility and control over graphic composition.

Highlights

  • New Flattening Capabilities: Introduced new methods to deeply flatten graphic tables, allowing extraction of only Color or GradientStops elements while preserving transformations and alpha blending.
  • New Node Graph Nodes: Added three new nodes: Flatten Color, Flatten Gradient, and Colors to Gradient, enhancing the graphic manipulation toolkit.
  • Node Relocation: The Index Elements node was relocated within the graphic nodes for improved organization and accessibility.
Changelog
  • node-graph/libraries/graphic-types/src/graphic.rs
    • Added into_flattened_color_table method to the IntoGraphicTable trait for extracting color elements from graphic tables.
    • Added into_flattened_gradient_table method to the IntoGraphicTable trait for extracting gradient elements from graphic tables.
  • node-graph/nodes/graphic/src/graphic.rs
    • Added index_elements node to retrieve elements from various collections by index, supporting negative indices.
    • Added flatten_color node, which utilizes the new into_flattened_color_table to output a table of colors.
    • Added flatten_gradient node, which utilizes the new into_flattened_gradient_table to output a table of gradient stops.
    • Added colors_to_gradient node to construct a GradientStops object from a table of colors, distributing them evenly.
    • Imported GradientStop from vector_types for use in gradient-related functionalities.
Activity
  • The pull request description indicates that it 'Closes Node for constructing a Gradient #2875 in the simple case', suggesting it addresses a known issue related to color and gradient handling.
  • The author, Keavon, has included two images in the PR description, likely demonstrating the functionality of the new nodes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new nodes for creating gradients from colors and for flattening color and gradient tables within the graphic structure. The implementation adds into_flattened_color_table and into_flattened_gradient_table methods and their corresponding nodes, along with a colors_to_gradient node. The changes are well-implemented and add valuable functionality. I have a couple of suggestions to improve code maintainability and readability.

@Keavon Keavon merged commit cde7d5f into master Feb 26, 2026
6 checks passed
@Keavon Keavon deleted the gradient-nodes branch February 26, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node for constructing a Gradient

1 participant