From 8d8afbddf5b3cc92fd6ce0e9d23ce4dd7dec9492 Mon Sep 17 00:00:00 2001 From: Romeo Fragomeli Date: Wed, 1 Jun 2022 10:21:12 +0000 Subject: [PATCH] [REF] web: backport `.text-bg-#{$color}` from BS 5.2 Add the new helper `.text-bg-#{$color}` to restore the old behaviour like in BS4 for the `.bg-#{$color}` In short, in BS5 `.bg-#{$color}` don't change anymore the text color but only the background. `.text-bg-#{$color}` change both color text and background. Task ID: 2766483 Part-of: odoo/odoo#95450 --- addons/web/__manifest__.py | 1 + .../src/libs/bootstrap/helpers_backport.scss | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 addons/web/static/src/libs/bootstrap/helpers_backport.scss diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index dd987e3851f..d9bb32f49c4 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -327,6 +327,7 @@ This module provides the core of the Odoo Web Client. ], 'web._assets_bootstrap': [ 'web/static/src/legacy/scss/import_bootstrap.scss', + 'web/static/src/libs/bootstrap/helpers_backport.scss', 'web/static/src/legacy/scss/bootstrap_review.scss', ], 'web._assets_backend_helpers': [ diff --git a/addons/web/static/src/libs/bootstrap/helpers_backport.scss b/addons/web/static/src/libs/bootstrap/helpers_backport.scss new file mode 100644 index 00000000000..5be62d05c0d --- /dev/null +++ b/addons/web/static/src/libs/bootstrap/helpers_backport.scss @@ -0,0 +1,14 @@ +// Backport from BS 5.2 +// TODO remove me when migrate to new Bootstrap 5.2 + + +$prefix: '' !default; +$theme-colors: () !default; + +// All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251 +@each $color, $value in $theme-colors { + $color-rgb: to-rgb($value); + .text-bg-#{$color} { + color: color-contrast($value) !important; + background-color: RGBA($color-rgb, var(--#{$prefix}bg-opacity, 1)) !important; + } +}