Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 4f33473

Browse files
Shi Shucopybara-github
authored andcommitted
style(tooltip): Add background color styling for the rich tooltip.
PiperOrigin-RevId: 345224611
1 parent c7edfc7 commit 4f33473

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

packages/mdc-tooltip/_tooltip-theme.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
$background-color: rgba(black, theme-color.text-emphasis(medium));
3434
$border-radius: small;
3535
$label-color: text-primary-on-dark;
36+
37+
// Rich Tooltip variables
38+
$rich-background-color: rgba(white, theme-color.text-emphasis(medium));
39+
$rich-text-color: text-primary-on-light;
40+
3641
// Use a custom property so IE11 does not use "normal" and instead uses provided
3742
// fall-back value.
3843
$word-break-custom-prop: custom-properties.create(
@@ -96,6 +101,17 @@ $z-index: 2;
96101
}
97102
}
98103

104+
// Sets the color of the rich tooltip text.
105+
// @param {Color | String} $color
106+
@mixin rich-text-ink-color($color, $query: feature-targeting.all()) {
107+
$feat-color: feature-targeting.create-target($query, color);
108+
@include feature-targeting.targets($feat-color) {
109+
.mdc-tooltip__surface {
110+
@include theme.prop(color, $color);
111+
}
112+
}
113+
}
114+
99115
// Sets the fill/surface color of the tooltip.
100116
// @param {Color | String} $color
101117
@mixin fill-color($color, $query: feature-targeting.all()) {

packages/mdc-tooltip/_tooltip.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ $exit-duration: 75ms;
8787

8888
&.mdc-tooltip--rich {
8989
@include elevation-mixins.elevation(2, $query: $query);
90+
@include tooltip-theme.fill-color(
91+
tooltip-theme.$rich-background-color,
92+
$query: $query
93+
);
94+
@include tooltip-theme.rich-text-ink-color(
95+
tooltip-theme.$rich-text-color,
96+
$query: $query
97+
);
9098
@include feature-targeting.targets($feat-structure) {
9199
display: inline-block;
92100
border-radius: $_rich_corner_radius;

0 commit comments

Comments
 (0)