From c2f27bf74300f3074f02900d8370769341eb79a0 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 4c2e073904..9424470a75 100644 --- a/node-graph/nodes/graphic/src/graphic.rs +++ b/node-graph/nodes/graphic/src/graphic.rs @@ -997,7 +997,7 @@ pub fn flatten_gradient(_: impl Ctx, #[implementations(List< } /// 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"))] fn colors_to_gradient(_: impl Ctx, #[implementations(List, List)] colors: T) -> Gradient { Gradient::from(colors.into_flattened_list::()) } diff --git a/node-graph/nodes/math/src/lib.rs b/node-graph/nodes/math/src/lib.rs index f7c45153e3..53df8cd3ee 100644 --- a/node-graph/nodes/math/src/lib.rs +++ b/node-graph/nodes/math/src/lib.rs @@ -1204,13 +1204,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)) } @@ -1218,7 +1218,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: List) -> Gradient { let positions: Vec = positions.iter_element_values().copied().collect(); gradient.set_positions(&positions); @@ -1230,7 +1230,7 @@ fn gradient_positions(_: impl Ctx, mut gradient: Gradient, positions: List) /// 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: List) -> Gradient { let midpoints: Vec = midpoints.iter_element_values().copied().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).",