Skip to content

Custom a theme

This document will explain how to change a theme when working with morethemes. It can be useful to change a small part of a theme without having to create a new one.


Example

Under the hood, morethemes uses the matplotlib rcParams to change the theme. Therefore, all the parameters you can change with matplotlib can be changed with morethemes.

For example, the yellowish theme has a yellow background.

import morethemes as mt

mt.set_theme("yellowish")
mt.preview_theme()

Let's say we want to change the background color. The background color is set using 2 parameters:

  • figure.facecolor: the background color of the figure
  • axes.facecolor: the background color of the axes

Here, they have the same color, so we have to change both. If we want to set a blue background, we can do the following:

import morethemes as mt
import matplotlib.pyplot as plt

mt.set_theme("yellowish")
plt.rcParams["figure.facecolor"] = "skyblue"
plt.rcParams["axes.facecolor"] = "skyblue"

mt.preview_theme()

There is no easy way to know what parameters you need to change to fit your exact needs, but you can find more info in the create your theme page.