Skip to content

Set dark and light theme #1627

Answered by willser
VideoCarp asked this question in Q&A
Discussion options

You must be logged in to vote
use eframe::egui::{Style, Visuals};

let native_options = eframe::NativeOptions::default();
eframe::run_native(
    "test",
    native_options,
    Box::new(|creation_context| {
        let style = Style {
            visuals: Visuals::dark(),
            ..Style::default()
        };
        creation_context.egui_ctx.set_style(style);
        Box::new(<ur struct>)
    }),
);

Or

ui.style_mut().visuals = Visuals::dark();

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by VideoCarp
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants