Tutor Indigo v22.1.0: a simpler way to customize the MFE styles

Hi everyone,

Customizing the look of the MFEs with Indigo has been harder than it should be: brand changes don’t show up (example), image rebuilds take a long time for every change, and the documentation doesn’t match what actually works.

Tutor Indigo v22.1.0 (Verawood), released by the @tutor-maintainers, focuses on fixing this workflow. Here’s what changed, and how to use it.

How Indigo styles your platform

Indigo styles two different parts of the platform, in two different ways:

Part Styled by How to change it
LMS/CMS pages (course about, legacy pages, emails) Indigo’s theme files and INDIGO_PRIMARY_COLOR Edit the theme, then rebuild the openedx image
MFEs (learning, learner dashboard, profile, account, discussions, authoring, authn, catalog…) The compiled CSS of a brand-openedx repository Edit your brand-openedx fork (this post)

Most of the confusion came from mixing these two up: for instance, INDIGO_PRIMARY_COLOR does not change the MFEs. Their colors come from the brand-openedx design tokens.

Live development of your brand with tutor dev

This was the most requested improvement, and the @tutor-maintainers made it part of Indigo itself. Point Indigo to a local clone of your brand-openedx fork:

git clone <your-brand-openedx-repository-url> /path/to/brand-openedx
tutor config save --set INDIGO_BRAND_OPENEDX_PATH=/path/to/brand-openedx
tutor dev launch

Indigo then runs an indigo-brand container that:

  • installs the brand’s dependencies and builds its CSS (no npm install on your machine);
  • watches your files and rebuilds on save:
    • SCSS changes (paragon/*.scss, themes/) rebuild core.css in a few seconds;
    • design token changes (paragon/tokens/) rebuild all the CSS in about 2 minutes;
  • serves the CSS at http://localhost:3000, and makes all the MFEs load it from there.

You don’t need to rebuild the MFE image: save, wait for the rebuild, refresh the page. You can follow the builds with tutor dev logs -f indigo-brand. The previous CSS keeps being served during a rebuild, so pages never break mid-build.

INDIGO_BRAND_OPENEDX_PATH only applies to tutor dev. Production isn’t affected, even if the setting is left in your config.

Example: changing the primary color

  1. In your fork, edit paragon/tokens/src/themes/light/color.json and change color.primary.base, e.g. to #E4572E.
  2. Wait for the rebuild to finish (tutor dev logs -f indigo-brand).
  3. Refresh any MFE: buttons, links and other primary elements use the new color.

Do the same in themes/dark/ for the dark theme, and set INDIGO_PRIMARY_COLOR to the same color so that the LMS/CMS pages match.

Use your own brand in production, without patching the plugin

The MFEs load three files from a single setting, INDIGO_BRAND_CSS_BASE_URL, which was suggested by the @tutor-maintainers during review so that forks can use their own brand in production: core.min.css, light.min.css and dark.min.css. To ship your brand:

  1. Make sure the last build has finished, so that dist/ contains your changes.

  2. Commit dist/ to your fork, then tag and push:

     git tag my-brand-1.0.0 && git push origin my-brand-1.0.0
    
  3. Point Indigo to it:

     tutor config save --set INDIGO_BRAND_CSS_BASE_URL=https://cdn.jsdelivr.net/gh/<your-org>/<your-brand-repo>@my-brand-1.0.0/dist
     tutor local restart lms
    

The MFEs read this URL at runtime, so there’s no MFE image to rebuild when you change your brand. Updating your brand later means pushing a new tag and updating the setting. Rolling back means setting the previous tag.

A few tips:

  • Use tags rather than branch names in jsDelivr URLs. jsDelivr may serve a branch from its cache for up to 12 hours, but tags are served right away and never change.
  • jsDelivr only works with public repositories. For a private brand, serve the three files from any server that returns them as text/css with CORS headers: your own CDN, object storage, etc.
  • By default, INDIGO_BRAND_CSS_BASE_URL points to a tagged version of Indigo’s own brand (indigo-3.1.1), so each Indigo release always loads the same, tested styles.

Faster MFE builds

The MFE images no longer install the @edx/brand package: the brand CSS is loaded at runtime instead. Builds are faster and no longer need to reach GitHub.

Settings reference

Setting Default Purpose
INDIGO_BRAND_CSS_BASE_URL jsDelivr URL of edly-io/brand-openedx@indigo-3.1.1/dist Where the MFEs load the brand CSS from, in production
INDIGO_BRAND_OPENEDX_PATH "" (disabled) Local brand-openedx clone for live development with tutor dev
INDIGO_BRAND_OPENEDX_DEV_PORT 3000 Port of the local brand CSS server
INDIGO_BRAND_OPENEDX_DEV_DOCKER_IMAGE docker.io/node:22 Image used to build the brand in development

Upgrading

pip install --upgrade "tutor-indigo>=22.1.0,<23"
tutor config save
tutor images build mfe
tutor local launch

The MFE image needs to be rebuilt once, because the @edx/brand installation was removed from it.

Things to know:

  • If you installed a custom @edx/brand package with the mfe-dockerfile-post-npm-install patch, as the old README suggested: remove that patch, publish your brand’s dist/ and set INDIGO_BRAND_CSS_BASE_URL instead.
  • Indigo’s core stylesheet now also applies to MFEs it didn’t style before (e.g. gradebook, ORA grading, communications).
  • If the brand CSS can’t be loaded (e.g. jsDelivr is unreachable), the MFEs fall back to the default Open edX brand bundled in the image.
  • If you use the paragon plugin (tutor-contrib-paragon), the local brand-openedx CSS takes precedence over its themes when INDIGO_BRAND_OPENEDX_PATH is set.

Checking that your brand is loaded

Open an MFE, then the “Network” tab of your browser’s developer tools, and filter on “css”: core.min.css, light.min.css and dark.min.css should be loaded from the URL that you expect (localhost:3000 in development, INDIGO_BRAND_CSS_BASE_URL in production). If your changes don’t show up, reload the page without the browser cache.

Links

What’s next

More Indigo improvements are on the way from the @tutor-maintainers, and we’ll share them here as they land.

Feedback welcome

A big thank you to the @tutor-maintainers for their reviews and their work on this release.

If you try it, we’d really like to hear how it goes, especially if something doesn’t work as described. Reply here, tag your topic with tutor-indigo, or mention the @tutor-maintainers in your question. Issues and PRs are welcome on GitHub.

2 Likes