Rename the 'Hex to Color' node to 'String to Color' (#4523)

This commit is contained in:
Keavon Chambers
2026-09-12 16:52:32 -07:00
committed by GitHub
parent 96024d6c2c
commit 21cceeb7ba
2 changed files with 7 additions and 3 deletions

View File

@@ -399,6 +399,10 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
node: graphene_std::math_nodes::sine_inverse::IDENTIFIER,
aliases: &["graphene_math_nodes::SineInverseNode", "graphene_core::ops::SineInverseNode"],
},
NodeReplacement {
node: graphene_std::math_nodes::string_to_color::IDENTIFIER,
aliases: &["math_nodes::HexToColorNode"],
},
NodeReplacement {
node: graphene_std::math_nodes::subtract::IDENTIFIER,
aliases: &["graphene_math_nodes::SubtractNode", "graphene_core::ops::SubtractNode"],

View File

@@ -1365,9 +1365,9 @@ fn hsla_to_color(
}
/// Constructs a color value from a CSS color string. Accepts hex (`#RRGGBB`, `#RRGGBBAA`, plus bare and shorthand variants), CSS named colors (like `red`), and functional notations (`rgb(...)`, `hsl(...)`, etc.). Invalid inputs produce a transparent color.
#[node_macro::node(category("Color"), name("Hex to Color"))]
fn hex_to_color(_: impl Ctx, hex_code: Item<String>) -> Item<Color> {
let color = core_types::misc::parse_css_color(hex_code.element()).unwrap_or_default();
#[node_macro::node(category("Color"), name("String to Color"))]
fn string_to_color(_: impl Ctx, string: Item<String>) -> Item<Color> {
let color = core_types::misc::parse_css_color(string.element()).unwrap_or_default();
Item::new_from_element(color)
}