Added some simple colorscheme setters
These don't properly expose the implot style yet in a way that is consistent with imgui-rs' handling of styles. This is to be added later.
This commit is contained in:
parent
d02f25fb32
commit
af760648b6
2 changed files with 36 additions and 1 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
use imgui::{im_str, Condition, Window};
|
||||
use implot::Context;
|
||||
|
||||
|
|
|
@ -48,6 +48,42 @@ impl Context {
|
|||
pub fn get_plot_ui(&self) -> PlotUi {
|
||||
PlotUi { context: self }
|
||||
}
|
||||
|
||||
/// Use light colors for the implot style.
|
||||
///
|
||||
/// This will eventually be exposed more thoroughly in the form of ImPlotStyle,
|
||||
/// but for now this allows one to at least easily set the color preset.
|
||||
pub fn use_light_colors(&self) {
|
||||
unsafe {
|
||||
let style = sys::ImPlot_GetStyle();
|
||||
assert_ne!(style, std::ptr::null_mut());
|
||||
sys::ImPlot_StyleColorsLight(style);
|
||||
}
|
||||
}
|
||||
|
||||
/// Use dark colors for the implot style.
|
||||
///
|
||||
/// This will eventually be exposed more thoroughly in the form of ImPlotStyle,
|
||||
/// but for now this allows one to at least easily set the color preset.
|
||||
pub fn use_dark_colors(&self) {
|
||||
unsafe {
|
||||
let style = sys::ImPlot_GetStyle();
|
||||
assert_ne!(style, std::ptr::null_mut());
|
||||
sys::ImPlot_StyleColorsDark(style);
|
||||
}
|
||||
}
|
||||
|
||||
/// Use classic colors for the implot style.
|
||||
///
|
||||
/// This will eventually be exposed more thoroughly in the form of ImPlotStyle,
|
||||
/// but for now this allows one to at least easily set the color preset.
|
||||
pub fn use_classic_colors(&self) {
|
||||
unsafe {
|
||||
let style = sys::ImPlot_GetStyle();
|
||||
assert_ne!(style, std::ptr::null_mut());
|
||||
sys::ImPlot_StyleColorsClassic(style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Context {
|
||||
|
|
Loading…
Reference in a new issue