Move the gradient-focused nodes from the Color category to a new Gradient category (#4403)

This commit is contained in:
Keavon Chambers
2026-08-04 04:27:37 -07:00
committed by GitHub
parent b2265be88f
commit e907a4d574
3 changed files with 7 additions and 6 deletions

View File

@@ -1007,7 +1007,7 @@ pub async fn flatten_gradient<T: IntoGraphicList>(_: impl Ctx, #[implementations
}
/// 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<T: IntoGraphicList>(_: impl Ctx, #[implementations(List<Graphic>, List<Color>)] colors: T) -> Item<Gradient> {
Item::new_from_element(Gradient::from(colors.into_flattened_list::<Color>()))
}

View File

@@ -1378,7 +1378,7 @@ 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: Item<Gradient>, gradient_type: Item<vector_types::GradientType>) -> Item<Gradient> {
let mut gradient = gradient;
gradient.set_attribute(core_types::ATTR_GRADIENT_TYPE, *gradient_type.element());
@@ -1386,7 +1386,7 @@ fn gradient_type(_: impl Ctx, gradient: Item<Gradient>, gradient_type: Item<vect
}
/// 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: Item<Gradient>, spread_method: Item<vector_types::GradientSpreadMethod>) -> Item<Gradient> {
let mut gradient = gradient;
gradient.set_attribute(core_types::ATTR_SPREAD_METHOD, *spread_method.element());
@@ -1396,7 +1396,7 @@ fn spread_method(_: impl Ctx, gradient: Item<Gradient>, spread_method: Item<vect
/// 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, gradient: Item<Gradient>, positions: List<f64>) -> Item<Gradient> {
let mut gradient = gradient;
let positions: Vec<f64> = positions.iter_element_values().copied().collect();
@@ -1409,7 +1409,7 @@ fn gradient_positions(_: impl Ctx, gradient: Item<Gradient>, positions: List<f64
/// 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, gradient: Item<Gradient>, midpoints: List<f64>) -> Item<Gradient> {
let mut gradient = gradient;
let midpoints: Vec<f64> = midpoints.iter_element_values().copied().collect();

View File

@@ -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).",