mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 23:58:12 +08:00
Rename the 'Hex to Color' node to 'String to Color' (#4523)
This commit is contained in:
@@ -399,6 +399,10 @@ const NODE_REPLACEMENTS: &[NodeReplacement<'static>] = &[
|
|||||||
node: graphene_std::math_nodes::sine_inverse::IDENTIFIER,
|
node: graphene_std::math_nodes::sine_inverse::IDENTIFIER,
|
||||||
aliases: &["graphene_math_nodes::SineInverseNode", "graphene_core::ops::SineInverseNode"],
|
aliases: &["graphene_math_nodes::SineInverseNode", "graphene_core::ops::SineInverseNode"],
|
||||||
},
|
},
|
||||||
|
NodeReplacement {
|
||||||
|
node: graphene_std::math_nodes::string_to_color::IDENTIFIER,
|
||||||
|
aliases: &["math_nodes::HexToColorNode"],
|
||||||
|
},
|
||||||
NodeReplacement {
|
NodeReplacement {
|
||||||
node: graphene_std::math_nodes::subtract::IDENTIFIER,
|
node: graphene_std::math_nodes::subtract::IDENTIFIER,
|
||||||
aliases: &["graphene_math_nodes::SubtractNode", "graphene_core::ops::SubtractNode"],
|
aliases: &["graphene_math_nodes::SubtractNode", "graphene_core::ops::SubtractNode"],
|
||||||
|
|||||||
@@ -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.
|
/// 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"))]
|
#[node_macro::node(category("Color"), name("String to Color"))]
|
||||||
fn hex_to_color(_: impl Ctx, hex_code: Item<String>) -> Item<Color> {
|
fn string_to_color(_: impl Ctx, string: Item<String>) -> Item<Color> {
|
||||||
let color = core_types::misc::parse_css_color(hex_code.element()).unwrap_or_default();
|
let color = core_types::misc::parse_css_color(string.element()).unwrap_or_default();
|
||||||
Item::new_from_element(color)
|
Item::new_from_element(color)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user