1
Fork 0

Add -Zgraphviz_dark_mode

Many developers use a dark theme with editors and IDEs, but this
typically doesn't extend to graphviz output.

When I bring up a MIR graphviz document, the white background is
strikingly bright. This new option changes the colors used for graphviz
output to work better in dark-themed UIs.
This commit is contained in:
Rich Kadel 2020-09-08 16:08:35 -07:00
parent 5099914a16
commit c19b2370e4
4 changed files with 46 additions and 11 deletions

View file

@ -306,7 +306,11 @@ where
let mut buf = Vec::new();
let graphviz = graphviz::Formatter::new(body, def_id, results, style);
dot::render_opts(&graphviz, &mut buf, &[dot::RenderOption::Monospace])?;
let mut render_opts = vec![dot::RenderOption::Monospace];
if tcx.sess.opts.debugging_opts.graphviz_dark_mode {
render_opts.push(dot::RenderOption::DarkTheme);
}
dot::render_opts(&graphviz, &mut buf, &render_opts)?;
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)?;