Skip to content

Contributing

This document focuses on adding themes to morethemes, but other kind of contributions are possible. Feel free to open an issue to discuss it.

In this tutorial, I'll assume your theme is named sunglasses, as for the example. Remember to change it with the actual name of your theme.

Setup your environment

  • Fork the repository to your own GitHub account.

  • Clone your forked repository to your local machine (ensure you have Git installed):

git clone https://github.com/YOURUSERNAME/morethemes.git
cd morethemes
  • Create a new branch for your theme:
git checkout -b sunglasses
  • Set up your Python environment (ensure you have uv installed):
uv sync --all-extras
uv pip install -e .
uv run pre-commit install
  • Check that everything works:
uv run pytest

Add a new theme

  • In morethemes/themes.py, add a new theme that looks like this:
sunglasses_theme = {
    "name": "sunglasses", # the name of your theme
    "author": "Your Name", # your name or the name of the author
    "description": "A description of the theme",
    "theme": { # all arguments passed to plt.rcParams
        "axes.facecolor": "#232323",
        "figure.facecolor": "#282828",
    },
}

Note

If you're looking how to make a (great) theme, check this.

  • At the end of morethemes/morethemes/themes.py, add your theme to ALL_THEMES:
ALL_THEMES = {
    "darker": darker_theme,
    "lighter": lighter_theme,
    "sunglasses": sunglasses_theme, # add your theme here
}

Test the theme

  • Test that everything works correctly by running:
uv run pytest

Push changes

  • Commit and push your changes:
git add -A
git commit -m "add sunglasses theme"
git push
  • Go back to your fork and click on the "Open a PR" popup

Congrats! Once your PR is merged, it will be part of morethemes and accessible via mt.set_theme("sunglasses"). It'll be available once a new released is published on PyPI.

Feel free to ask me if you have any questions!