Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/matplotlib/python/dunestyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
4 changes: 2 additions & 2 deletions src/matplotlib/stylelib/dune.mplstyle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 22 additions & 1 deletion src/root/cpp/include/DUNEStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -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<Cycle, std::vector<Color_t>> kColorCycles
{
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
Loading