diff --git a/changelog.d/20260204_182918_136305115+HammadYousaf01_dark_theme_logo_support.md b/changelog.d/20260204_182918_136305115+HammadYousaf01_dark_theme_logo_support.md new file mode 100644 index 000000000..0853843d0 --- /dev/null +++ b/changelog.d/20260204_182918_136305115+HammadYousaf01_dark_theme_logo_support.md @@ -0,0 +1 @@ +- [Improvement] Add dark theme logo support. (by @HammadYousaf01, @arbirali) \ No newline at end of file diff --git a/tutorindigo/patches/mfe-env-config-runtime-definitions b/tutorindigo/patches/mfe-env-config-runtime-definitions index 2ca9812af..323d313d2 100644 --- a/tutorindigo/patches/mfe-env-config-runtime-definitions +++ b/tutorindigo/patches/mfe-env-config-runtime-definitions @@ -202,19 +202,64 @@ const MobileViewHeader = () => { }; return (
+ {intl.formatMessage(messages["mobile.view.header.logo.altText"])} + {intl.formatMessage(messages["mobile.view.header.logo.altText"])}
); }; + +const ThemedLogo = () => { + const BASE_URL = getConfig().LMS_BASE_URL; + + return ( + <> + + + Open edX + Open edX + + + ); +}; diff --git a/tutorindigo/plugin.py b/tutorindigo/plugin.py index 56b412da6..ff085771f 100644 --- a/tutorindigo/plugin.py +++ b/tutorindigo/plugin.py @@ -8,7 +8,7 @@ import importlib_resources from tutor import hooks from tutor.__about__ import __version_suffix__ -from tutormfe.hooks import PLUGIN_SLOTS +from tutormfe.hooks import MFE_APPS, MFE_ATTRS_TYPE, PLUGIN_SLOTS from .__about__ import __version__ @@ -195,7 +195,7 @@ def _override_openedx_docker_image( ( mfe, "org.openedx.frontend.layout.footer.v1", - """ + """ { op: PLUGIN_OPERATIONS.Hide, widgetId: 'default_contents', @@ -226,7 +226,7 @@ def _override_openedx_docker_image( ( mfe, "desktop_secondary_menu_slot", - """ + """ { op: PLUGIN_OPERATIONS.Insert, widget: { @@ -254,7 +254,7 @@ def _override_openedx_docker_image( ( mfe, "mobile_header_slot", - """ + """ { op: PLUGIN_OPERATIONS.Insert, widget: { @@ -284,7 +284,7 @@ def _override_openedx_docker_image( ( "learning", "learning_help_slot", - """ + """ { op: PLUGIN_OPERATIONS.Insert, widget: { @@ -320,3 +320,32 @@ def _override_openedx_docker_image( """ hooks.Filters.ENV_PATCHES.add_item(("mfe-lms-common-settings", fstring)) + + +@MFE_APPS.add() # type: ignore +def _add_themed_logo( + mfes: dict[str, MFE_ATTRS_TYPE], +) -> dict[str, MFE_ATTRS_TYPE]: + for mfe in mfes: + PLUGIN_SLOTS.add_item( + ( + str(mfe), + "logo_slot", + """ + { + op: PLUGIN_OPERATIONS.Hide, + widgetId: 'default_contents', + }, + { + op: PLUGIN_OPERATIONS.Insert, + widget: { + id: 'custom_logo', + type: DIRECT_PLUGIN, + RenderWidget: ThemedLogo, + } + } + """, + ) + ) + + return mfes diff --git a/tutorindigo/templates/indigo/lms/static/images/logo-white.png b/tutorindigo/templates/indigo/lms/static/images/logo-white.png new file mode 100644 index 000000000..c85190e14 Binary files /dev/null and b/tutorindigo/templates/indigo/lms/static/images/logo-white.png differ diff --git a/tutorindigo/templates/indigo/lms/static/sass/extra/_header.scss b/tutorindigo/templates/indigo/lms/static/sass/extra/_header.scss index fbcef085e..662a2c01a 100644 --- a/tutorindigo/templates/indigo/lms/static/sass/extra/_header.scss +++ b/tutorindigo/templates/indigo/lms/static/sass/extra/_header.scss @@ -57,6 +57,17 @@ header.global-header { .logo { height: 24px; margin: 0; + + body.indigo-dark-theme & { + display: none; + } + } + .logo-white { + display: none; + + body.indigo-dark-theme & { + display: inline-block; + } } } .course-header { @@ -283,8 +294,6 @@ header.global-header { } } - - body.indigo-dark-theme { background: $body-bg-d !important; color: $text-color-d !important; diff --git a/tutorindigo/templates/indigo/lms/templates/header/navbar-logo-header.html b/tutorindigo/templates/indigo/lms/templates/header/navbar-logo-header.html index 43e1d1eae..3724939f0 100644 --- a/tutorindigo/templates/indigo/lms/templates/header/navbar-logo-header.html +++ b/tutorindigo/templates/indigo/lms/templates/header/navbar-logo-header.html @@ -29,7 +29,8 @@ % else: <%block name="navigation_logo"> - + + % if settings.LOGO_IMAGE_EXTRA_TEXT == 'edge': | EDGE