4

How to access certain SCSS variables in Angular-Material (Angular4)?

For example, the default toolbar has a CSS class as follow:

.mat-toolbar {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    padding: 0 16px;
    flex-direction: column;
}

I want to get the padding value, i.e. 16px, store it as $fatty-padding and then use it in my custom class, for example:

.custom-toolbar {
    padding: $fatty-padding $fatty-padding;
    margin: 0 $fatty-padding;
}

Is it possible?

1 Answer 1

1

Angular Material styles are written without variables:

enter image description here

So there is no easy way to get this styles and store to the variable in SCSS.

Sign up to request clarification or add additional context in comments.

2 Comments

What about colors? Isn't it possible to get the default theme colors? It feels like something that would be useful.
@user276648, I have tried, but failed, I can't extract the specific color from Angular Material's theme. So there are two cases: 1. I don't have enough skills. 2. It's not possible. I can't really say, what case is it, but when I'm looking at AM theme, I feel that it should be possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.