Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions editor/src/messages/portfolio/document_migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Comment thread
Keavon marked this conversation as resolved.
},
NodeReplacement {
node: graphene_std::math_nodes::subtract::IDENTIFIER,
aliases: &["graphene_math_nodes::SubtractNode", "graphene_core::ops::SubtractNode"],
Expand Down
6 changes: 3 additions & 3 deletions node-graph/nodes/math/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
Loading