mirror of
https://github.com/eliasstepanik/egui_node_graph.git
synced 2026-01-11 13:58:28 +00:00
added titlebar_color()
This commit is contained in:
parent
dc47f7dc33
commit
72d1001a3f
@ -323,15 +323,12 @@ where
|
|||||||
let mut responses = Vec::new();
|
let mut responses = Vec::new();
|
||||||
|
|
||||||
let background_color;
|
let background_color;
|
||||||
let titlebar_color;
|
|
||||||
let text_color;
|
let text_color;
|
||||||
if ui.visuals().dark_mode {
|
if ui.visuals().dark_mode {
|
||||||
background_color = color_from_hex("#3f3f3f").unwrap();
|
background_color = color_from_hex("#3f3f3f").unwrap();
|
||||||
titlebar_color = background_color.lighten(0.8);
|
|
||||||
text_color = color_from_hex("#fefefe").unwrap();
|
text_color = color_from_hex("#fefefe").unwrap();
|
||||||
} else {
|
} else {
|
||||||
background_color = color_from_hex("#ffffff").unwrap();
|
background_color = color_from_hex("#ffffff").unwrap();
|
||||||
titlebar_color = background_color.lighten(0.8);
|
|
||||||
text_color = color_from_hex("#505050").unwrap();
|
text_color = color_from_hex("#505050").unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,7 +519,10 @@ where
|
|||||||
let titlebar = Shape::Rect(RectShape {
|
let titlebar = Shape::Rect(RectShape {
|
||||||
rect: titlebar_rect,
|
rect: titlebar_rect,
|
||||||
rounding,
|
rounding,
|
||||||
fill: titlebar_color,
|
fill: self.graph[self.node_id]
|
||||||
|
.user_data
|
||||||
|
.titlebar_color(ui, self.node_id, self.graph, user_state)
|
||||||
|
.unwrap_or(background_color.lighten(0.8)),
|
||||||
stroke: Stroke::none(),
|
stroke: Stroke::none(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,18 @@ where
|
|||||||
) -> Vec<NodeResponse<Self::Response>>
|
) -> Vec<NodeResponse<Self::Response>>
|
||||||
where
|
where
|
||||||
Self::Response: UserResponseTrait;
|
Self::Response: UserResponseTrait;
|
||||||
|
|
||||||
|
/// Set background color on titlebar
|
||||||
|
/// If the return value is None, the default color is set.
|
||||||
|
fn titlebar_color(
|
||||||
|
&self,
|
||||||
|
_ui: &egui::Ui,
|
||||||
|
_node_id: NodeId,
|
||||||
|
_graph: &Graph<Self, Self::DataType, Self::ValueType>,
|
||||||
|
_user_state: &Self::UserState,
|
||||||
|
) -> Option<egui::Color32> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This trait can be implemented by any user type. The trait tells the library
|
/// This trait can be implemented by any user type. The trait tells the library
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user