|
| 1 | +# Theming |
| 2 | + |
| 3 | +Theming an Open edX instance involves 2 parts: |
| 4 | + |
| 5 | +- **Legacy UI:** Using comprehensive theming. This is natively [supported by Tutor](https://docs.tutor.edly.io/tutorials/theming.html). |
| 6 | +- **MFEs:** Using Design Tokens. This is supported by the [grove-simple-theme](https://gitlab.com/opencraft/dev/tutor-contrib-grove/-/tree/main/tutorgrove/plugins/simple_theme) Tutor plugin using [edx-simple-theme](https://github.com/open-craft/edx-simple-theme). |
| 7 | + |
| 8 | +## Customizing an Instance |
| 9 | + |
| 10 | +### Legacy UI using a comprehensive theme |
| 11 | + |
| 12 | +Tutor requires the comprehensive theme to be added to an instance' `env` directory in a specific path. That can be accomplished using `PICASSO_EXTRA_COMMANDS` in the instance's `config.yml`. For example: |
| 13 | + |
| 14 | +```yaml |
| 15 | +PICASSO_EXTRA_COMMANDS: |
| 16 | + # Clone the comprehensive theme to the build directory as Tutor expects |
| 17 | + - git clone https://github.com/my-org/my-theme.git "$(tutor config printroot)/env/build/openedx/themes/my-theme" |
| 18 | +``` |
| 19 | +
|
| 20 | +This will add `my-theme` to the `openedx` Docker image and can activated by changing the *Site theme* for LMS or Studio from the Django Admin. |
| 21 | + |
| 22 | +!!! warning "Important" |
| 23 | + |
| 24 | + The `edx-simple-theme` from OpenCraft historically supported customizing both the legacy LMS UI elements and the MFEs in a single package. This is **no longer the case**. If an instance uses it for customizing the legacy UI parts: |
| 25 | + |
| 26 | + 1. If the instance is using a release branch like `release/teak`, create a branch from it. If the instance already has a custom branch, go to next step. |
| 27 | + 2. Remove the following from `.gitignore` |
| 28 | + * `lms/static/sass/_lms-overrides.scss` |
| 29 | + * `lms/static/sass/common-variables.scss` |
| 30 | + 3. Create those 2 files. Could be empty, or add your customizations. |
| 31 | + 4. Commit and push your branch |
| 32 | + 5. Use the new branch in the `git clone` command under `PICASSO_EXTRA_COMMANDS`. |
| 33 | + |
| 34 | + This is required as, historically, these files were created by Grove from instance configuration. |
| 35 | + |
| 36 | +### MFEs using Design Tokens |
| 37 | + |
| 38 | +Theming using Design Tokens is the only theming system from the Ulmo release and beyond. It involves defining the branding customizations in design token spec and then using Paragon CLI to compile it to CSS, which can then be included in the MFEs. |
| 39 | + |
| 40 | +The *edx-simple-theme* with the *grove-simple-theme* Tutor plugin simplify this process for instance operators. |
| 41 | + |
| 42 | +1. Declare the cutomization values under `GROVE_THEMES` in `config.yml`. |
| 43 | +1. Install *tutor-contrib-grove*, enable *grove-simple-theme* plugin and generate the theme tokens using `PICASSO_EXTRA_COMMANDS`. |
| 44 | + |
| 45 | +```yaml |
| 46 | +GROVE_THEMES: |
| 47 | + core: |
| 48 | + size.border.radius.base: 0 |
| 49 | + size.border.radius.lg: 0 |
| 50 | + size.border.radius.sm: 0 |
| 51 | +PICASSO_EXTRA_COMMADS: |
| 52 | + - pip install git+https://gitlab.com/opencraft/dev/tutor-contrib-grove |
| 53 | + - tutor plugins enable grove-simple-theme |
| 54 | + - tutor generate-tokens |
| 55 | +``` |
| 56 | + |
| 57 | +!!! tip |
| 58 | + |
| 59 | + The `grove-simple-theme` plugin supports plain CSS to be added using `SIMPLE_THEME_EXTRA_CSS` attribute in `config.yml` as well. |
| 60 | + |
| 61 | +## Related Documentation |
| 62 | + |
| 63 | +- [Theming configuration](https://gitlab.com/opencraft/dev/tutor-contrib-grove/) section for more details on theming using `GROVE_THEMES` |
| 64 | +- [edx-simple-theme](https://github.com/open-craft/edx-simple-theme) - The skeleton used to customize the themes of Open edX instances. |
0 commit comments