diff --git a/public/theme/boost/lang/en/theme_boost.php b/public/theme/boost/lang/en/theme_boost.php index 432c34cc498..db911973e5f 100644 --- a/public/theme/boost/lang/en/theme_boost.php +++ b/public/theme/boost/lang/en/theme_boost.php @@ -25,6 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $string['advancedsettings'] = 'Advanced settings'; +$string['aigeneratedimage'] = 'AI generated image'; $string['backgroundimage'] = 'Background image'; $string['backgroundimage_desc'] = 'The image to display as a background of the site. The background image you upload here will override the background image in your theme preset files.'; $string['brandcolor'] = 'Brand colour'; diff --git a/public/theme/boost/lib.php b/public/theme/boost/lib.php index 1e08db56f6f..31bdb6a5d93 100644 --- a/public/theme/boost/lib.php +++ b/public/theme/boost/lib.php @@ -58,19 +58,36 @@ function theme_boost_get_extra_scss($theme) { // Sets the login background image. $loginbackgroundimageurl = $theme->setting_file_url('loginbackgroundimage', 'loginbackgroundimage'); $backgroundposition = ''; - if (empty($loginbackgroundimageurl)) { + $isdefaultloginimage = empty($loginbackgroundimageurl); + if ($isdefaultloginimage) { // Use the default login background image. $loginbackgroundimageurl = $theme->image_url( 'login_background', 'theme', ); - // Set the default background position to ensure the watermark is visible. - $backgroundposition = 'background-position: bottom right;'; + // Set the default background position to center. + $backgroundposition = 'background-position: center;'; } $content .= 'body.pagelayout-login #page .login-layout-left { '; - $content .= "background-image: url('$loginbackgroundimageurl'); background-size: cover; {$backgroundposition}"; + $content .= "background-image: url('$loginbackgroundimageurl'); "; + $content .= "background-size: cover; {$backgroundposition} position: relative;"; $content .= ' }'; + // Add a watermark to indicate the image is AI generated, but only for the default image. + if ($isdefaultloginimage) { + $content .= 'body.pagelayout-login #page .login-layout-left::after {'; + // Escape the label for use in a CSS string value: collapse newlines (which would break the CSS string) + // and escape single quotes and backslashes via addcslashes. + $ailabel = preg_replace('/[\r\n]+/', ' ', get_string('aigeneratedimage', 'theme_boost')); + $content .= " content: '" . addcslashes($ailabel, "'\\") . "';"; + $content .= ' position: absolute; bottom: 1rem; right: 1rem;'; + $content .= ' color: $white;'; + $content .= ' font-size: 0.8rem;'; + $content .= ' text-shadow: 0 1px 2px $black;'; + $content .= ' pointer-events: none;'; + $content .= ' }'; + } + // Always return the background image with the scss when we have it. return !empty($theme->settings->scss) ? "{$theme->settings->scss} \n {$content}" : $content; } diff --git a/public/theme/boost/pix/login_background.jpg b/public/theme/boost/pix/login_background.jpg index 4bb0cb99d8f..d4173697c35 100644 Binary files a/public/theme/boost/pix/login_background.jpg and b/public/theme/boost/pix/login_background.jpg differ diff --git a/public/theme/boost/scss/moodle/login.scss b/public/theme/boost/scss/moodle/login.scss index 364b1524442..aba66193bc9 100644 --- a/public/theme/boost/scss/moodle/login.scss +++ b/public/theme/boost/scss/moodle/login.scss @@ -1,7 +1,7 @@ $login-layout-left-bg: $primary !default; $login-layout-panel-padding: 3rem !default; $login-layout-content-width: 576px !default; -$login-layout-copy-width: 360px !default; +$login-layout-copy-width: 450px !default; $login-input-bg: $gray-100 !default; .pagelayout-login { @@ -34,6 +34,7 @@ $login-input-bg: $gray-100 !default; .login-layout-left-content { max-width: $login-layout-copy-width; text-align: center; + text-shadow: 1px 1px 3px $black; } .login-layout-stats { diff --git a/public/theme/boost/style/moodle.css b/public/theme/boost/style/moodle.css index bdbcdcf5e84..d513903f188 100644 --- a/public/theme/boost/style/moodle.css +++ b/public/theme/boost/style/moodle.css @@ -35599,8 +35599,9 @@ textarea[data-auto-rows] { } .login-layout-left-content { - max-width: 360px; + max-width: 450px; text-align: center; + text-shadow: 1px 1px 3px #000000; } .login-layout-stats { diff --git a/public/theme/classic/lang/en/theme_classic.php b/public/theme/classic/lang/en/theme_classic.php index 2ed2627014b..3767244b0ac 100644 --- a/public/theme/classic/lang/en/theme_classic.php +++ b/public/theme/classic/lang/en/theme_classic.php @@ -26,6 +26,7 @@ defined('MOODLE_INTERNAL') || die(); // Raw SCSS setting. +$string['aigeneratedimage'] = 'AI generated image'; $string['choosereadme'] = 'Classic is a highly-customisable theme, based on Boost, with an alternative navigation layout. This theme is intended to be used directly, or as a parent theme when creating or updating custom themes to utilise Bootstrap 4.'; $string['configtitle'] = 'Classic'; $string['navbardark'] = 'Use a dark style navbar'; diff --git a/public/theme/classic/lib.php b/public/theme/classic/lib.php index bdac2e137f8..5e4c8d21e9a 100644 --- a/public/theme/classic/lib.php +++ b/public/theme/classic/lib.php @@ -109,19 +109,36 @@ function theme_classic_get_extra_scss($theme) { // Sets the login background image. $loginbackgroundimageurl = $theme->setting_file_url('loginbackgroundimage', 'loginbackgroundimage'); $backgroundposition = ''; - if (empty($loginbackgroundimageurl)) { + $isdefaultloginimage = empty($loginbackgroundimageurl); + if ($isdefaultloginimage) { // Use the default login background image. $loginbackgroundimageurl = $theme->image_url( 'login_background', 'theme', ); - // Set the default background position to ensure the watermark is visible. - $backgroundposition = 'background-position: bottom right;'; + // Set the default background position to center. + $backgroundposition = 'background-position: center;'; } $content .= 'body.pagelayout-login #page .login-layout-left { '; - $content .= "background-image: url('$loginbackgroundimageurl'); background-size: cover; {$backgroundposition}"; + $content .= "background-image: url('$loginbackgroundimageurl'); "; + $content .= "background-size: cover; {$backgroundposition} position: relative;"; $content .= ' }'; + // Add a watermark to indicate the image is AI generated, but only for the default image. + if ($isdefaultloginimage) { + $content .= 'body.pagelayout-login #page .login-layout-left::after {'; + // Escape the label for use in a CSS string value: collapse newlines (which would break + // the CSS string) and escape single quotes and backslashes via addcslashes. + $ailabel = preg_replace('/[\r\n]+/', ' ', get_string('aigeneratedimage', 'theme_classic')); + $content .= " content: '" . addcslashes($ailabel, "'\\") . "';"; + $content .= ' position: absolute; bottom: 1rem; right: 1rem;'; + $content .= ' color: $white;'; + $content .= ' font-size: 0.8rem;'; + $content .= ' text-shadow: 0 1px 2px $black;'; + $content .= ' pointer-events: none;'; + $content .= ' }'; + } + if (!empty($theme->settings->navbardark)) { $content .= file_get_contents($CFG->dirroot . '/theme/classic/scss/classic/navbar-dark.scss'); diff --git a/public/theme/classic/pix/login_background.jpg b/public/theme/classic/pix/login_background.jpg index 4bb0cb99d8f..d4173697c35 100644 Binary files a/public/theme/classic/pix/login_background.jpg and b/public/theme/classic/pix/login_background.jpg differ diff --git a/public/theme/classic/style/moodle.css b/public/theme/classic/style/moodle.css index a6d0d639f23..c03c364c311 100644 --- a/public/theme/classic/style/moodle.css +++ b/public/theme/classic/style/moodle.css @@ -35599,8 +35599,9 @@ textarea[data-auto-rows] { } .login-layout-left-content { - max-width: 360px; + max-width: 450px; text-align: center; + text-shadow: 1px 1px 3px #000; } .login-layout-stats {