From 005ec323de2a75a82e2c49eadcdfd2ac25275d3d Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Wed, 2 Mar 2022 14:40:19 +0100 Subject: [PATCH] fix(material/checkbox): incorrect text color when placed inside an overlay with a dark theme (#19054) This is along the same lines as #18742. The checkbox inherits its text color from the closest parent which may not be correct once the element is moved out into an overlay. (cherry picked from commit f20122a4998f65c46452dc680adaec49cea7c0f5) --- src/material/checkbox/_checkbox-theme.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/material/checkbox/_checkbox-theme.scss b/src/material/checkbox/_checkbox-theme.scss index 8b96f974432e..3053b509c643 100644 --- a/src/material/checkbox/_checkbox-theme.scss +++ b/src/material/checkbox/_checkbox-theme.scss @@ -32,6 +32,12 @@ fill: $checkbox-mark-color; } + .mat-checkbox-label { + // Explicitly set the text color since the checkbox may be + // inside an overlay that doesn't have the proper theme text color. + color: theming.get-color-from-palette($foreground, 'text'); + } + .mat-checkbox-checkmark-path { // !important is needed here because a stroke must be set as an // attribute on the SVG in order for line animation to work properly.