Skip to content

Commit

Permalink
feat: add dark theme for LMS pages and MFEs (#95)
Browse files Browse the repository at this point in the history
Co-authored-by: “tanveer65” <[email protected]>
  • Loading branch information
hinakhadim and tanveer65 authored Jul 23, 2024
1 parent d9d0819 commit f80eebb
Show file tree
Hide file tree
Showing 37 changed files with 2,222 additions and 1,023 deletions.
15 changes: 15 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Configuration
- ``INDIGO_WELCOME_MESSAGE`` (default: "The place for all your online learning")
- ``INDIGO_PRIMARY_COLOR`` (default: "#3b85ff")
- ``INDIGO_FOOTER_NAV_LINKS`` (default: ``[{"title": "About", "url": "/about"}, {"title": "Contact", "url": "/contact"}]``)
- ``INDIGO_ENABLE_DARK_THEME`` (default: False)

The ``INDIGO_*`` settings listed above may be modified by running ``tutor config save --set INDIGO_...=...``. For instance, to remove all links from the footer, run::

Expand All @@ -39,6 +40,20 @@ Or, to set the primary color to forest green, run::
# Note: The nested quotes are needed in order to handle the hash (#) correctly.
tutor config save --set 'INDIGO_PRIMARY_COLOR="#225522"'

Enabling Dark Theme
-------------------

To enable the dark theme for the whole platform, run::

tutor config save --set INDIGO_ENABLE_DARK_THEME=True
tutor images build openedx
tutor images build mfe
tutor local start -d

.. warning::
The dark theme can't be changed dynamically through any toggle button in platform. Using the above config variable, the platform will start with either Light theme or Dark theme.


Customization
-------------

Expand Down
1 change: 1 addition & 0 deletions changelog.d/20240709_232049_hina.khadim_redwood_dark.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Feature] Dark theme: the Indigo theme now covers dark theme for LMS pages, including the MFEs, and they are more beautiful! (by @tanveer65 and @hinakhadim)
Empty file removed tutorindigo/patches/.gitignore
Empty file.
58 changes: 49 additions & 9 deletions tutorindigo/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"defaults": {
"VERSION": __version__,
"WELCOME_MESSAGE": "The place for all your online learning",
"ENABLE_DARK_THEME": False,
"PRIMARY_COLOR": "#15376D", # Indigo
# Footer links are dictionaries with a "title" and "url"
# To remove all links, run:
Expand Down Expand Up @@ -105,42 +106,81 @@ def _override_openedx_docker_image(
(
"mfe-dockerfile-post-npm-install-learning",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^1.0.0'
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %}
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0'
RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0'
""",
# remove indigo-header and indigo-footer due to incompatible version deps of MFEs
),
(
"mfe-dockerfile-post-npm-install-authn",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^1.0.0'
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %}
""",
),
# Tutor-Indigo v2.1 targets the styling updates in discussions and learner-dashboard MFE
# brand-openedx is related to styling updates while others are for header and footer updates
(
"mfe-dockerfile-post-npm-install-discussions",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^1.0.0'
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %}
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0'
RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0'
""",
# remove indigo-header and indigo-footer due to incompatible version deps of MFEs
),
(
"mfe-dockerfile-post-npm-install-learner-dashboard",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^1.0.0'
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %}
RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0'
""",
# remove indigo-footer due to incompatible version deps of MFEs
),
(
"mfe-dockerfile-post-npm-install-profile",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^1.0.0'
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %}
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0'
RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0'
""",
),
(
"mfe-dockerfile-post-npm-install-account",
"""
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^1.0.0'
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.0.0'{% if INDIGO_ENABLE_DARK_THEME %} --theme=dark{% endif %}
RUN npm install '@edx/frontend-component-header@npm:@edly-io/indigo-frontend-component-header@^3.0.0'
RUN npm install '@edx/frontend-component-footer@npm:@edly-io/indigo-frontend-component-footer@^2.0.0'
""",
),
]
)

# Include js file in lms main.html, main_django.html, and certificate.html

hooks.Filters.ENV_PATCHES.add_items(
[
# for production
(
"openedx-common-assets-settings",
"""
javascript_files = ['base_application', 'application', 'certificates_wv']
dark_theme_filepath = ['indigo/js/dark-theme.js']
for filename in javascript_files:
if filename in PIPELINE['JAVASCRIPT']:
PIPELINE['JAVASCRIPT'][filename]['source_filenames'] += dark_theme_filepath
""",
),
# for development
(
"openedx-lms-development-settings",
"""
javascript_files = ['base_application', 'application', 'certificates_wv']
dark_theme_filepath = ['indigo/js/dark-theme.js']
for filename in javascript_files:
if filename in PIPELINE['JAVASCRIPT']:
PIPELINE['JAVASCRIPT'][filename]['source_filenames'] += dark_theme_filepath
""",
),
]
Expand Down
3 changes: 3 additions & 0 deletions tutorindigo/templates/indigo/lms/static/images/Vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f80eebb

Please sign in to comment.