|
| 1 | +# brand-example-purple |
| 2 | + |
| 3 | +**This is a simple example brand package that changes the `brand` color to purple.** |
| 4 | + |
| 5 | +### Before |
| 6 | + |
| 7 | + |
| 8 | +### After |
| 9 | + |
| 10 | + |
| 11 | +## Using this brand package |
| 12 | + |
| 13 | +> [!IMPORTANT] |
| 14 | +> These instructions assume you have a [tutor](https://docs.tutor.edly.io/index.html) main environment set up. |
| 15 | +
|
| 16 | +### Configure `tutor` to use this theme |
| 17 | + |
| 18 | +#### Using the [`jsdelivr`](https://www.jsdelivr.com/) CDN (Recommended) |
| 19 | + |
| 20 | +1. Stop `tutor` (`tutor dev stop` or `tutor local stop`) |
| 21 | +2. Navigate to your local tutor plugins directory (`tutor plugins printroot`) |
| 22 | +3. Create a new `purple-jsdelivr.py` plugin file with the following content |
| 23 | + |
| 24 | +```py |
| 25 | +import json |
| 26 | +from tutor import hooks |
| 27 | + |
| 28 | +paragon_theme_urls = { |
| 29 | + "variants": { |
| 30 | + "light": { |
| 31 | + "urls": { |
| 32 | + "default": "https://cdn.jsdelivr.net/npm/@openedx/paragon@$paragonVersion/dist/light.min.css", |
| 33 | + "brandOverride": "https://cdn.jsdelivr.net/gh/openedx/sample-plugin@main/brand/dist/light.min.css" |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | +} |
| 38 | + |
| 39 | +fstring = f""" |
| 40 | +MFE_CONFIG["PARAGON_THEME_URLS"] = {json.dumps(paragon_theme_urls)} |
| 41 | +""" |
| 42 | + |
| 43 | +hooks.Filters.ENV_PATCHES.add_item( |
| 44 | + ( |
| 45 | + "mfe-lms-common-settings", |
| 46 | + fstring |
| 47 | + ) |
| 48 | +) |
| 49 | +``` |
| 50 | + |
| 51 | +4. Enable the plugin (`tutor plugins enable purple-jsdelivr`) |
| 52 | +5. Start `tutor` (`tutor dev start lms cms mfe` or `tutor local start lms cms mfe`) |
| 53 | + |
| 54 | +#### Using the [Tutor Paragon Plugin](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon) (Recommended) |
| 55 | + |
| 56 | +1. [Install](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#installation) and [enable](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#enable-the-plugin) the Tutor Paragon Plugin (`tutor-contrib-paragon`) |
| 57 | +2. [Build](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#build-the-paragon-image) the `paragon-builder` image. |
| 58 | +2. Navigate to your Tutor config directory (you can find this by running `tutor config printroot`) |
| 59 | +3. From your config directory, navigate to `env/plugins/paragon` (the full path on my dev machine is `~/.local/share/tutor-main/env/plugins/paragon`) |
| 60 | +4. You should see some directories in there, find the `theme-sources` directory. |
| 61 | +5. Place this theme's [`color.json` file](./src/tokens/src/themes/light/global/color.json) in the appropriate subdirectory of the `theme-sources` directory. |
| 62 | +```sh |
| 63 | +$ tree ~/.local/share/tutor-main/env/plugins/paragon |
| 64 | +├── [...] |
| 65 | +└── theme-sources |
| 66 | + └── themes |
| 67 | + └── light |
| 68 | + └── global |
| 69 | + └── color.json |
| 70 | +``` |
| 71 | +6. [Build](https://github.com/openedx/openedx-tutor-plugins/tree/main/plugins/tutor-contrib-paragon#build-all-themes) the theme |
| 72 | +7. Start `tutor` (`tutor dev start lms cms mfe` or `tutor local start lms cms mfe`) |
0 commit comments