diff --git a/src/matplotlib/python/dunestyle.py b/src/matplotlib/python/dunestyle.py index 9d95661..e99c8ea 100644 --- a/src/matplotlib/python/dunestyle.py +++ b/src/matplotlib/python/dunestyle.py @@ -146,3 +146,10 @@ def SetOkabeItoColors(): from cycler import cycler cyc = cycler(color=['#000000', '#D55E00', '#56B4E9', '#E69F00', '#009E73', '#CC79A7', '#0072B2', '#F0E442',]) plt.rc("axes", prop_cycle=cyc) + +def off_white_bkg(): + """ Set the background color of the figure to match the off-white background of the updated DUNE slide template. """ + + plt.rcParams['axes.facecolor'] = '#f0f0f0' + plt.rcParams['figure.facecolor'] = '#f0f0f0' + plt.rcParams['savefig.facecolor'] = '#f0f0f0' diff --git a/src/matplotlib/stylelib/dune.mplstyle b/src/matplotlib/stylelib/dune.mplstyle index 49a406c..76b4c5e 100644 --- a/src/matplotlib/stylelib/dune.mplstyle +++ b/src/matplotlib/stylelib/dune.mplstyle @@ -13,9 +13,9 @@ text.hinting_factor : 8 #mathtext.fontset : cm -figure.facecolor: white +figure.facecolor: white (default, can be changed with off_white_bkg to #f0f0f0 for slides) -axes.facecolor: white # eeeeee +axes.facecolor: white # eeeeee (default, can be changed with off_white_bkg to #f0f0f0 for slides) axes.edgecolor: black axes.grid : False axes.linewidth: 1.0 diff --git a/src/root/cpp/include/DUNEStyle.h b/src/root/cpp/include/DUNEStyle.h index 430afa9..8aa69c6 100644 --- a/src/root/cpp/include/DUNEStyle.h +++ b/src/root/cpp/include/DUNEStyle.h @@ -90,6 +90,12 @@ namespace dunestyle throw std::out_of_range("Unknown OIColor"); } } + + const TColor & GetOffWhiteColor() + { + static const TColor __kOffWhite(TColor::GetFreeColorIndex(), 0.9412, 0.9412, 0.9412); + return __kOffWhite; + } } // ---------------------------------------------------------------------------- @@ -122,6 +128,9 @@ namespace dunestyle inline Color_t kOkabeItoRedPurple = _internal::GetOIColor(_internal::OIColors::kRedPurple).GetNumber(); ///@} + /// Off-white color, used to improve access for those with dyslexia + inline Color_t kOffWhite = _internal::GetOffWhiteColor().GetNumber(); + /// If you would like all the colors in one package const std::map> kColorCycles { @@ -332,6 +341,17 @@ namespace dunestyle gStyle->SetPalette(n_color_contours, colors); } + // ---------------------------------------------------------------------------- + void OffWhiteBackground() + { + gStyle->SetFillColor(colors::kOffWhite); + gStyle->SetFrameFillColor(colors::kOffWhite); + gStyle->SetCanvasColor(colors::kOffWhite); + gStyle->SetTitleFillColor(colors::kOffWhite); + gStyle->SetPadColor(colors::kOffWhite); + gStyle->SetStatColor(colors::kOffWhite); + } + // ---------------------------------------------------------------------------- /// Divide a TCanvas into two pads. @@ -440,7 +460,8 @@ namespace dunestyle // No info box duneStyle->SetOptStat(0); - //set the background color to white + //set the background color to white. + // see OffWhiteBackground() above for an alternative... duneStyle->SetFillColor(10); duneStyle->SetFrameFillColor(10); duneStyle->SetCanvasColor(10);