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

Commit f841afe

Browse files
authored
feat(theme): Added new function for text emphasis opacities
1 parent 036edc0 commit f841afe

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

packages/mdc-theme/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,15 @@ Params:
179179
@debug mdc-theme-accessible-ink-color(secondary); // rgba(0, 0, 0, .87) (text-primary-on-light)
180180
@debug mdc-theme-accessible-ink-color(blue); // white (text-primary-on-dark)
181181
```
182+
#### `mdc-theme-text-emphasis($emphasis)`
183+
184+
Returns opacity value for given emphasis.
185+
186+
Params:
187+
188+
- `$emphasis`: Type of emphasis such as `high`, `medium` & `disabled`.
189+
190+
```scss
191+
@debug mdc-theme-text-emphasis(high); // .87
192+
@debug mdc-theme-text-emphasis(disabled); // .38
193+
```

packages/mdc-theme/_variables.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ $mdc-theme-text-colors: (
6262
)
6363
) !default;
6464

65+
$mdc-theme-text-emphasis: (
66+
high: .87,
67+
medium: .6,
68+
disabled: .38,
69+
);
70+
6571
@function mdc-theme-ink-color-for-fill_($text-style, $fill-color) {
6672
$contrast-tone: mdc-theme-contrast-tone($fill-color);
6773

@@ -144,3 +150,7 @@ $mdc-theme-property-values: (
144150
@function mdc-theme-is-valid-theme-prop-value_($style) {
145151
@return type-of($style) == "color" or $style == "currentColor" or str_slice($style, 1, 4) == "var(";
146152
}
153+
154+
@function mdc-theme-text-emphasis($emphasis) {
155+
@return map-get($mdc-theme-text-emphasis, $emphasis);
156+
}

0 commit comments

Comments
 (0)