From 8d4f1346a1fef43d54246332a7d0fd552b2d3ea7 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Tue, 4 Aug 2026 04:27:37 -0700 Subject: [PATCH] Move the gradient-focused nodes from the Color category to a new Gradient category (#4403) --- node-graph/nodes/graphic/src/graphic.rs | 2 +- node-graph/nodes/math/src/lib.rs | 8 ++++---- tools/node-docs/src/utility.rs | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/node-graph/nodes/graphic/src/graphic.rs b/node-graph/nodes/graphic/src/graphic.rs index 1363e3ee99..376bf69988 100644 --- a/node-graph/nodes/graphic/src/graphic.rs +++ b/node-graph/nodes/graphic/src/graphic.rs @@ -556,7 +556,7 @@ pub fn flatten_gradient<'e>( } /// Constructs a gradient from a `Color[]`, where the colors are evenly distributed as gradient stops across the range from 0 to 1. -#[node_macro::node(category("Color"), name("Colors to Gradient"))] +#[node_macro::node(category("Gradient"), name("Colors to Gradient"))] pub fn colors_to_gradient(_: impl Ctx, colors: IList) -> Gradient { Gradient::from(colors.iter().collect::>()) } diff --git a/node-graph/nodes/math/src/lib.rs b/node-graph/nodes/math/src/lib.rs index d433432b7f..0cc9287114 100644 --- a/node-graph/nodes/math/src/lib.rs +++ b/node-graph/nodes/math/src/lib.rs @@ -1203,13 +1203,13 @@ fn gradient_value(_: impl Ctx, _primary: (), #[default(Color::BLACK, Color::WHIT } /// Sets the type (linear or radial) of each gradient in the input list. -#[node_macro::node(category("Color"))] +#[node_macro::node(category("Gradient"))] fn gradient_type(_: impl Ctx, gradient: Gradient, gradient_type: vector_types::GradientType) -> (Gradient, Attr) { (gradient, Attr(gradient_type)) } /// Sets how each gradient in the input list extends past its endpoints: Pad, Reflect, or Repeat. -#[node_macro::node(category("Color"))] +#[node_macro::node(category("Gradient"))] fn spread_method(_: impl Ctx, gradient: Gradient, spread_method: vector_types::GradientSpreadMethod) -> (Gradient, Attr) { (gradient, Attr(spread_method)) } @@ -1217,7 +1217,7 @@ fn spread_method(_: impl Ctx, gradient: Gradient, spread_method: vector_types::G /// Sets the position of each of a gradient's stops, a factor from 0 to 1 along the gradient. /// /// A list shorter than the stop count repeats its last value, a longer list is truncated, and an empty list sets each stop to its default evenly spaced position. -#[node_macro::node(category("Color"))] +#[node_macro::node(category("Gradient"))] fn gradient_positions(_: impl Ctx, mut gradient: Gradient, positions: IList) -> Gradient { let positions: Vec = positions.iter().collect(); gradient.set_positions(&positions); @@ -1229,7 +1229,7 @@ fn gradient_positions(_: impl Ctx, mut gradient: Gradient, positions: IList /// The final stop belongs to no interval so its midpoint is ignored. /// /// A list shorter than the stop count repeats its last value, a longer list is truncated, and an empty list sets each midpoint to its default of 0.5. -#[node_macro::node(category("Color"))] +#[node_macro::node(category("Gradient"))] fn gradient_midpoints(_: impl Ctx, mut gradient: Gradient, midpoints: IList) -> Gradient { let midpoints: Vec = midpoints.iter().collect(); gradient.set_midpoints(&midpoints); diff --git a/tools/node-docs/src/utility.rs b/tools/node-docs/src/utility.rs index b8734742c8..898ad0c622 100644 --- a/tools/node-docs/src/utility.rs +++ b/tools/node-docs/src/utility.rs @@ -13,13 +13,14 @@ pub fn category_description(category: &str) -> &str { " ), "Blending" => "Nodes in this category control how overlapping graphical content is composited together, considering blend modes, opacity, and clipping.", - "Color" => "Nodes in this category deal with selecting and manipulating colors, gradients, and palettes.", + "Color" => "Nodes in this category deal with selecting and manipulating colors and palettes.", "Debug" => indoc!( " Nodes in this category are temporarily included for debugging purposes by Graphite's developers. They may have rare potential uses for advanced users, but are not intended for general use and will be removed in future releases. " ), "General" => "Nodes in this category deal with general data handling, such as merging and flattening graphical elements.", + "Gradient" => "Nodes in this category build gradients and adjust the placement of their color stops, as well as the shape and repetition of the transition between them.", "Context" => "Nodes in this category read data from the evaluation context supplied by downstream nodes, such as the current loop iteration index.", "Repeat" => "Nodes in this category enable the duplication, arrangement, and looped generation of graphical elements.", "Math: Arithmetic" => "Nodes in this category perform common arithmetic operations on numerical values (and where applicable, `vec2` values).",