Skip to content

Commit 4ce8bad

Browse files
brian-smith-tcrilfeanil
authored andcommitted
feat: add brand example
1 parent 4ec27ea commit 4ce8bad

File tree

16 files changed

+5590
-0
lines changed

16 files changed

+5590
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ This sample plugin showcases the **Open edX Hooks Extension Framework**, which a
3333
| **Events (Signals)** | React to platform events | [Open edX Events Guide](https://docs.openedx.org/projects/openedx-events/en/latest/) | [`backend/sample_plugin/signals.py`](./backend/sample_plugin/signals.py) | Integrating with external systems, audit logging |
3434
| **Filters** | Modify platform behavior | [Using Open edX Filters](https://docs.openedx.org/projects/openedx-filters/en/latest/how-tos/using-filters.html) | [`backend/sample_plugin/pipeline.py`](./backend/sample_plugin/pipeline.py) | Customizing business logic, URL redirects |
3535
| **Frontend Slots** | Customize MFE interfaces | [Frontend Plugin Slots](https://docs.openedx.org/en/latest/site_ops/how-tos/use-frontend-plugin-slots.html) | [`frontend/`](./frontend/) | UI customization, adding new components |
36+
| **Brand Packages** | Customize theming | [Open edX Brand Package Interface](https://github.com/openedx/brand-openedx) | [`brand/`](./brand/) | UI theming |
3637
| **Tutor Plugin** | Deploy plugins easily | [Tutor Plugin Development](https://docs.tutor.edly.io/) | [`tutor/`](./tutor/) | Simplified deployment and configuration |
3738

3839
## Quick Start Guide

brand/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# brand-example-purple
2+
3+
**This is a simple example brand package that changes the `brand` color to purple.**
4+
5+
### Before
6+
![Screenshot of the Authn MFE with this brand package enabled](./docs/images/authn-without-theme.png)
7+
8+
### After
9+
![Screenshot of the Authn MFE with this brand package enabled](./docs/images/authn-with-theme.png)
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`)

brand/dist/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Compiled Theme
2+
3+
This directory contains the compiled theme stylesheets referenced by the [`jsdelivr`](https://www.jsdelivr.com/) example plugin.

brand/dist/light.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Do not edit directly, this file was auto-generated.
3+
* See <PARAGON_ROOT>/tokens/README.md for more details.
4+
*/
5+
6+
:root {
7+
--pgn-size-btn-focus-width: 2px;
8+
--pgn-size-input-btn-focus-width: 1px;
9+
--pgn-spacing-input-btn-padding-y: 0.5625rem;
10+
--pgn-color-brand-100: #E9D4FFFF;
11+
--pgn-color-brand-200: #DAB2FFFF;
12+
--pgn-color-brand-300: #C27AFFFF;
13+
--pgn-color-brand-400: #AD46FFFF;
14+
--pgn-color-brand-600: #8200DBFF;
15+
--pgn-color-brand-700: #6E11B0FF;
16+
--pgn-color-brand-800: #59168BFF;
17+
--pgn-color-brand-900: #3C0366FF;
18+
--pgn-color-brand-base: #9810FAFF;
19+
--pgn-spacing-form-input-padding-y-base: var(--pgn-spacing-input-btn-padding-y);
20+
--pgn-color-brand-500: var(--pgn-color-brand-base); /** Brand color of level 500. */
21+
--pgn-color-action-default-brand-100: #CFA1FFFF;
22+
--pgn-color-action-default-brand-200: #C17FFFFF;
23+
--pgn-color-action-default-brand-300: #AB47FFFF;
24+
--pgn-color-action-default-brand-400: #9613FFFF;
25+
--pgn-color-action-default-brand-600: #6400A8FF;
26+
--pgn-color-action-default-brand-700: #510D81FF;
27+
--pgn-color-action-default-brand-800: #3D0F5FFF;
28+
--pgn-color-action-default-brand-900: #1F0234FF;
29+
--pgn-color-action-default-brand-base: #7C04D3FF;
30+
--pgn-color-action-default-brand-500: #7C04D3FF;
31+
}

brand/dist/light.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

brand/dist/light.min.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

brand/dist/theme-urls.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"themeUrls": {
3+
"defaults": {
4+
"light": "light"
5+
},
6+
"variants": {
7+
"light": {
8+
"paths": {
9+
"default": "./light.css",
10+
"minified": "./light.min.css"
11+
}
12+
}
13+
}
14+
}
15+
}
46.5 KB
Loading
46.6 KB
Loading

brand/src/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
paragon
3+
dist

0 commit comments

Comments
 (0)