Skip to content

Commit bf1b81f

Browse files
committed
feat: white logo for dark theme
1 parent cd8b22b commit bf1b81f

File tree

5 files changed

+49
-30
lines changed

5 files changed

+49
-30
lines changed

tutorindigo/patches/mfe-env-config-runtime-definitions

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@ const ThemedLogo = () => {
55
<>
66
<style>
77
{`
8-
.themed-logo {
9-
width: 36px;
10-
height: 24px;
11-
background: no-repeat center/contain url("${BASE_URL}/static/indigo/images/logo.png");
8+
#root header .logo.logo-white {
9+
display: none;
10+
}
11+
body.indigo-dark-theme #root header .logo {
12+
display: none;
13+
}
14+
body.indigo-dark-theme #root header .logo-white {
15+
display: inline-block;
1216
}
13-
14-
{% if INDIGO_ENABLE_DARK_THEME_LOGO %}
15-
body.indigo-dark-theme .themed-logo {
16-
background-image: url("${BASE_URL}/static/indigo/images/logo-white.png");
17-
}
18-
{% endif %}
1917
`}
2018
</style>
21-
<a href={`${BASE_URL}/dashboard`} className="logo" title="Logo">
22-
<div class="themed-logo" role="img" aria-label="Acme logo"></div>
19+
<a href={`${BASE_URL}/dashboard`} title="Open edX">
20+
<img className="logo" src={`${BASE_URL}/static/indigo/images/logo.png`} alt="Open edX" />
21+
<img className="logo logo-white" src={`${BASE_URL}/static/indigo/images/logo-white.png`} alt="Open edX" />
2322
</a>
2423
</>
2524
);
@@ -263,17 +262,36 @@ const MobileViewHeader = () => {
263262
};
264263
return (
265264
<div className="container-xl py-2 d-flex align-items-center justify-content-between">
265+
<style>
266+
{`
267+
.logo-image-white {
268+
display: none;
269+
}
270+
body.indigo-dark-theme .logo-image {
271+
display: none;
272+
}
273+
body.indigo-dark-theme .logo-image-white {
274+
display: block;
275+
}
276+
`}
277+
</style>
266278
<a
267279
className="logo"
268280
href={`${config.LMS_BASE_URL}/dashboard`}
269281
style={Object.assign({}, { display: "flex", alignItems: "center" })}
270282
>
271283
<img
272-
className="d-block"
284+
className="logo-image"
273285
src={`${config.LMS_BASE_URL}/theming/asset/images/logo.png`}
274286
alt={intl.formatMessage(messages["mobile.view.header.logo.altText"])}
275287
height={21}
276288
/>
289+
<img
290+
className="logo-image-white"
291+
src={`${config.LMS_BASE_URL}/theming/asset/images/logo-white.png`}
292+
alt={intl.formatMessage(messages["mobile.view.header.logo.altText"])}
293+
height={21}
294+
/>
277295
</a>
278296
<ToggleThemeButton />
279297
</div>

tutorindigo/plugin.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"WELCOME_MESSAGE": "The place for all your online learning",
2525
"PRIMARY_COLOR": "#15376D", # Indigo
2626
"ENABLE_DARK_TOGGLE": True,
27-
"ENABLE_DARK_THEME_LOGO": True,
2827
# Footer links are dictionaries with a "title" and "url"
2928
# To remove all links, run:
3029
# tutor config save --set INDIGO_FOOTER_NAV_LINKS=[]
@@ -195,7 +194,7 @@ def _override_openedx_docker_image(
195194
(
196195
mfe,
197196
"org.openedx.frontend.layout.footer.v1",
198-
"""
197+
"""
199198
{
200199
op: PLUGIN_OPERATIONS.Hide,
201200
widgetId: 'default_contents',
@@ -226,7 +225,7 @@ def _override_openedx_docker_image(
226225
(
227226
mfe,
228227
"desktop_secondary_menu_slot",
229-
"""
228+
"""
230229
{
231230
op: PLUGIN_OPERATIONS.Insert,
232231
widget: {
@@ -254,7 +253,7 @@ def _override_openedx_docker_image(
254253
(
255254
mfe,
256255
"mobile_header_slot",
257-
"""
256+
"""
258257
{
259258
op: PLUGIN_OPERATIONS.Insert,
260259
widget: {
@@ -284,7 +283,7 @@ def _override_openedx_docker_image(
284283
(
285284
"learning",
286285
"learning_help_slot",
287-
"""
286+
"""
288287
{
289288
op: PLUGIN_OPERATIONS.Insert,
290289
widget: {
@@ -316,7 +315,7 @@ def _add_themed_logo(
316315
{
317316
op: PLUGIN_OPERATIONS.Insert,
318317
widget: {
319-
id: 'custom_header',
318+
id: 'custom_logo',
320319
type: DIRECT_PLUGIN,
321320
RenderWidget: ThemedLogo,
322321
}
-59 Bytes
Loading

tutorindigo/templates/indigo/lms/static/sass/extra/_header.scss

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ header.global-header {
5757
.logo {
5858
height: 24px;
5959
margin: 0;
60+
61+
body.indigo-dark-theme & {
62+
display: none;
63+
}
64+
}
65+
.logo-white {
66+
display: none;
67+
68+
body.indigo-dark-theme & {
69+
display: inline-block;
70+
}
6071
}
6172
}
6273
.course-header {
@@ -283,17 +294,7 @@ header.global-header {
283294
}
284295
}
285296

286-
.logo {
287-
width: 36px;
288-
background: no-repeat center/contain url("/static/indigo/images/logo.png");
289-
}
290-
291297
body.indigo-dark-theme {
292-
{% if INDIGO_ENABLE_DARK_THEME_LOGO %}
293-
.logo {
294-
background-image: url("/static/indigo/images/logo-white.png");
295-
}
296-
{% endif %}
297298
background: $body-bg-d !important;
298299
color: $text-color-d !important;
299300
.window-wrap {

tutorindigo/templates/indigo/lms/templates/header/navbar-logo-header.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
% else:
3030
<a href="${branding_api.get_home_url()}" title="${_("{platform_name} Learner Home Page").format(platform_name=static.get_platform_name())}">
3131
<%block name="navigation_logo">
32-
<div class="logo" role="img" aria-label="Acme logo"></div>
32+
<img class="logo" src="${branding_api.get_logo_url(is_secure)}" alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}"/>
33+
<img class="logo logo-white" src="${static.url('images/logo-white.png')}" alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}"/>
3334
</%block>
3435
% if settings.LOGO_IMAGE_EXTRA_TEXT == 'edge':
3536
<span class="font-italic"> | EDGE</span>

0 commit comments

Comments
 (0)