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/github_user_name/morethemes.git
cd morethemes
git remote add upstream https://github.com/y-sunflower/morethemes.git
- Create a new branch for your theme:
- Set up your Python environment (ensure you have uv installed):
- Check that everything works:
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
"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 toALL_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:
Push changes
- Commit and push your changes:
- 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!