Skip to main content

Tutor plugin that simplifies branding an Open edX instance

Project description

This plugin, inspired in Indigo, allow changing the look and feel of Open edX installations. It can control the appearance of both legacy pages based on HTML (like the course catalog, dashboard, login, register, etc.), as well as MFE components.

Installation

pip install git+https://github.com/aulasneo/tutor-contrib-branding

Configuration

Customize colors

Most Bootstrap variables can be set using settings. These are the available variables and their defaults:

  • BRANDING_PRIMARY: #0000FF

  • BRANDING_SECONDARY: #454545

  • BRANDING_FONT_FAMILY: <no default>

  • BRANDING_BRAND: #9D0054

  • BRANDING_SUCCESS: #178253

  • BRANDING_INFO: #006DAA

  • BRANDING_DANGER: #C32D3A

  • BRANDING_WARNING: #FFD900

  • BRANDING_LIGHT: #E1DDDB

  • BRANDING_DARK: #273F2F

  • BRANDING_ACCENT_A: #00BBF9

  • BRANDING_ACCENT_B: #FFEE88

  • BRANDING_BACKGROUND: #ffffff

  • BRANDING_BG_PRIMARY: #ffffff

  • BRANDING_BODY: #FFFFFF

  • BRANDING_HOMEPAGE_BG_IMAGE: “”

You can add these settings to the config.yml file or using the tutor config --set "<setting>=<value>" command.

These settings affect the Bootstrap’s _variables.scss file in the comprehensive theme and in the MFE branding module.

You can also add CSS overrides using the BRANDING_EXTRAS and the BRANDING_OVERRIDES variables, to impact the comprehensive theme and the MFE branding module respectively.

E.g., this setting will add a CSS block to change the color of h1 texts in all MFE:

BRANDING_OVERRIDES: >-
  h1 {
        color: red;
  }

Managing fonts

Set BRANDING_FONTS_URLS to a list of URLS pointing to a zipped set of font files. Then use the tutor branding download-fonts command to download an unzip the font files to $(tutor config printroot)/env/build/openedx/themes/theme/lms/static/fonts and $(tutor config printroot)/env/plugins/mfe/build/mfe/brand-openedx/fonts if the mfe plugin is enabled.

Tip: copy the download url from the https://fonts.google.com site, for instance https://fonts.google.com/download?family=Roboto%20Flex.

E.g., to add Roboto Flex font, set:

BRANDING_FONTS_URLS:
- https://fonts.google.com/download?family=Roboto%20Flex

Then run

tutor branding download-fonts

To add a specific font definition, use the BRANDING_FONTS setting, e.g.:

BRANDING_FONTS: >-
    @font-face {
        font-family: 'Roboto Flex';
        src: url('RobotoFlex-VF.woff2') format('woff2 supports variations'),
           url('RobotoFlex-VF.woff2') format('woff2-variations');
    }

Learn more about using flex fonts here.

Finally, set the font family using the BRANDING_FONT_FAMILY variable:

BRANDING_FONT_FAMILY: Roboto Flex

Downloading images

CMS and LMS images can be included as long as they can be accessed through a HTTP(S) request. Most important images are:

LMS:

  • favicon.ico

  • logo.png

CMS:

  • studio-logo.png

A banner can also be added to the homepage.

E.g., to add custom logos and banner set the following:

BRANDING_LMS_IMAGES:
- filename: banner.png
  url: https://url/to/banner.png
- filename: favicon.ico
  url: https://url/to/favicon.ico
- filename: logo.png
  url: https://url/to/logo.png
BRANDING_CMS_IMAGES:
- filename: studio-logo.png
  url: https://url/to/studio-logo.png
BRANDING_HOMEPAGE_BG_IMAGE: banner.png

Then run

tutor branding download-images

Custom HTML block in home page

You can add a custom HTML code to be rendered in the home page after the banner and before the list of courses by setting BRANDING_INDEX_ADDITIONAL_HTML.

Customize HTML certificate

By setting BRANDING_CERTIFICATE_HTML you can override the standard certificate with your own HTML code.

Tip: Create a file with the HTML code (e.g., branding_certificate_html.html) and then update the configuration from the file.

tutor config save --set BRANDING_CERTIFICATE_HTML="$(cat branding_certificate_html.html)"

Customizing static pages

You can set your own HTML content to the typical static pages by setting the corresponding variable:

  • BRANDING_STATIC_TEMPLATE_404

  • BRANDING_STATIC_TEMPLATE_429

  • BRANDING_STATIC_TEMPLATE_ABOUT

  • BRANDING_STATIC_TEMPLATE_BLOG

  • BRANDING_STATIC_TEMPLATE_CONTACT

  • BRANDING_STATIC_TEMPLATE_DONATE

  • BRANDING_STATIC_TEMPLATE_EMBARGO

  • BRANDING_STATIC_TEMPLATE_FAQ

  • BRANDING_STATIC_TEMPLATE_HELP

  • BRANDING_STATIC_TEMPLATE_HONOR

  • BRANDING_STATIC_TEMPLATE_JOBS

  • BRANDING_STATIC_TEMPLATE_MEDIA_KIT

  • BRANDING_STATIC_TEMPLATE_NEWS

  • BRANDING_STATIC_TEMPLATE_PRESS

  • BRANDING_STATIC_TEMPLATE_PRIVACY

  • BRANDING_STATIC_TEMPLATE_SERVER_DOWN

  • BRANDING_STATIC_TEMPLATE_SERVER_ERROR

  • BRANDING_STATIC_TEMPLATE_SERVER_OVERLOADED

  • BRANDING_STATIC_TEMPLATE_SITEMAP

  • BRANDING_STATIC_TEMPLATE_TOS

Usage

tutor plugins enable branding
tutor branding download-images
tutor branding download-fonts
tutor images build openedx
tutor images build mfe
tutor local settheme theme

In K8s deployments, you will need to push the docker images and restart Tutor.

License

This software is licensed under the terms of the AGPLv3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tutor-contrib-branding-14.0.0.tar.gz (49.1 kB view details)

Uploaded Source

Built Distribution

tutor_contrib_branding-14.0.0-py3-none-any.whl (69.3 kB view details)

Uploaded Python 3

File details

Details for the file tutor-contrib-branding-14.0.0.tar.gz.

File metadata

  • Download URL: tutor-contrib-branding-14.0.0.tar.gz
  • Upload date:
  • Size: 49.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for tutor-contrib-branding-14.0.0.tar.gz
Algorithm Hash digest
SHA256 2692fd2863e308b21baf014c1651676b6b11f1eb1d0b187af8606bfd0e2e52bb
MD5 6d6e3cac4e2277f8e4d6732f6d2447d3
BLAKE2b-256 8103e8560fa4cac230844a6d4d50a272953386f27502eb03f59700835bf59c2e

See more details on using hashes here.

File details

Details for the file tutor_contrib_branding-14.0.0-py3-none-any.whl.

File metadata

  • Download URL: tutor_contrib_branding-14.0.0-py3-none-any.whl
  • Upload date:
  • Size: 69.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for tutor_contrib_branding-14.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66320870e9dd01e983c05476067c2fb7082adb53999dbb34846e7f7d123ac81a
MD5 9ff1ae5088945f5025149ad84c7a7d84
BLAKE2b-256 f2b67a4dd2c02c9b89d0558997b50fc347130d624be38efb21bd6fe4f024099d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page