[IMP] web, *: stop automatic color for text for transparent bg classes
* web_editor Now, if the opacity of the bg color for a bg classes is lower than x (currently 0.3), the class will only control the bg and not the text and other components anymore. This behavior is disabled for presets though (otherwise the text color would be "undefined"). Part of https://github.com/odoo/odoo/pull/45856 task-2197038
This commit is contained in:
@@ -27,15 +27,18 @@ $enable-deprecation-messages: false !default;
|
||||
}
|
||||
}
|
||||
|
||||
$o-yiq-min-opacity-threshold: 0.3 !default;
|
||||
$o-color-extras-nesting-selector: '&' !default;
|
||||
|
||||
@mixin o-bg-color($color, $text-color: null, $with-extras: true, $important: true, $nesting-selector: $o-color-extras-nesting-selector) {
|
||||
@mixin o-bg-color($color, $text-color: null, $with-extras: true, $important: true, $yiq-min-opacity-threshold: $o-yiq-min-opacity-threshold, $nesting-selector: $o-color-extras-nesting-selector) {
|
||||
@if ($color) {
|
||||
$-yiq-color: if($text-color, $text-color, color-yiq($color));
|
||||
$-yiq-threshold-met: alpha($color) > $yiq-min-opacity-threshold;
|
||||
|
||||
$-yiq-color: if($text-color, $text-color, if($-yiq-threshold-met, color-yiq($color), null));
|
||||
background-color: $color#{if($important, ' !important', '')};
|
||||
color: $-yiq-color; // not important so that text utilities still work
|
||||
|
||||
@if $with-extras {
|
||||
@if $with-extras and $-yiq-threshold-met {
|
||||
#{$nesting-selector} {
|
||||
@extend %o-bg-color-component-color-reset;
|
||||
|
||||
|
||||
@@ -615,7 +615,7 @@ blockquote {
|
||||
// bg and text utility classes. **
|
||||
.o_cc#{$index} {
|
||||
// Background & Text
|
||||
@include o-bg-color(o-color($-bg), o-color($-text), $important: false);
|
||||
@include o-bg-color(o-color($-bg), o-color($-text), $important: false, $yiq-min-opacity-threshold: 0);
|
||||
|
||||
#{$o-color-extras-nesting-selector} {
|
||||
// Headings
|
||||
|
||||
Reference in New Issue
Block a user