From b6741939394baa60b447f9ac5898631c66dfc321 Mon Sep 17 00:00:00 2001 From: Alexander Bias Date: Sat, 8 Jul 2023 08:59:45 +0200 Subject: [PATCH] Bugfix: Changing module purpose to other made icon background white instead of grey, solves #333. (#334) --- CHANGES.md | 1 + lib.php | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 215937f0e2f..1fc0409a635 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2023-07-07 - Bugfix: Changing module purpose to "other" made icon background white instead of grey, solves #333. * 2023-07-07 - Bugfix: Changing module purpose to "other" made icon invisible, solves #319. * 2023-06-26 - Bugfix: If the settings blockregionoutsiderightwidth or blockregionoutsiderightwidth were not set for any reason, the SCSS was not compiled, solves #325. diff --git a/lib.php b/lib.php index f6355c65995..4f672caac08 100644 --- a/lib.php +++ b/lib.php @@ -317,7 +317,14 @@ function theme_boost_union_get_extra_scss($theme) { // Add CSS to modify the activity purpose color in the activity chooser and the activity icon. $content .= '.activity.modtype_'.$modname.' .activityiconcontainer.courseicon,'; $content .= '.modchoosercontainer .modicon_'.$modname.'.activityiconcontainer { '; - $content .= 'background-color: var(--activity'.$theme->settings->{$configname}.') !important;'; + // If the purpose is now different than 'other', change the background color to the new color. + if ($theme->settings->{$configname} != MOD_PURPOSE_OTHER) { + $content .= 'background-color: var(--activity' . $theme->settings->{$configname} . ') !important;'; + + // Otherwise, the background color is set to light grey (as there is no '--activityother' variable). + } else { + $content .= 'background-color: $light !important;'; + } // If the default purpose originally was 'other' and now is overridden, make the icon white. if ($defaultpurpose == MOD_PURPOSE_OTHER) { $content .= '.activityicon { filter: brightness(0) invert(1); }';