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

Commit

Permalink
feat(theme): Added new function for text emphasis opacities
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiomkar authored Aug 24, 2018
1 parent 036edc0 commit f841afe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/mdc-theme/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,15 @@ Params:
@debug mdc-theme-accessible-ink-color(secondary); // rgba(0, 0, 0, .87) (text-primary-on-light)
@debug mdc-theme-accessible-ink-color(blue); // white (text-primary-on-dark)
```
#### `mdc-theme-text-emphasis($emphasis)`

Returns opacity value for given emphasis.

Params:

- `$emphasis`: Type of emphasis such as `high`, `medium` & `disabled`.

```scss
@debug mdc-theme-text-emphasis(high); // .87
@debug mdc-theme-text-emphasis(disabled); // .38
```
10 changes: 10 additions & 0 deletions packages/mdc-theme/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ $mdc-theme-text-colors: (
)
) !default;

$mdc-theme-text-emphasis: (
high: .87,
medium: .6,
disabled: .38,
);

@function mdc-theme-ink-color-for-fill_($text-style, $fill-color) {
$contrast-tone: mdc-theme-contrast-tone($fill-color);

Expand Down Expand Up @@ -144,3 +150,7 @@ $mdc-theme-property-values: (
@function mdc-theme-is-valid-theme-prop-value_($style) {
@return type-of($style) == "color" or $style == "currentColor" or str_slice($style, 1, 4) == "var(";
}

@function mdc-theme-text-emphasis($emphasis) {
@return map-get($mdc-theme-text-emphasis, $emphasis);
}

0 comments on commit f841afe

Please sign in to comment.