angular-material-css-vars icon indicating copy to clipboard operation
angular-material-css-vars copied to clipboard

Set font-style && font-sizes similar to custom theme color using the library.

Open Nanda-albanero opened this issue 3 years ago • 9 comments

Hi,

  • Do we have any option to apply the font-styles dynamically similar to apply theme color dynamically ?
       const hex = '#3f51b5';
       this.materialCssVarsService.setDarkTheme(true);
       this.materialCssVarsService.setPrimaryColor(hex);
       this.materialCssVarsService.setVariable(MaterialCssVariables.BackgroundCard,hex);
       this.materialCssVarsService.setAccentColor('#333');

Nanda-albanero avatar Jan 24 '21 14:01 Nanda-albanero

Not yet. But if somebody wants to add it, I am all for it. Should be mostly straightforward to implement.

johannesjo avatar Jan 25 '21 15:01 johannesjo

Not yet. But if somebody wants to add it, I am all for it. Should be mostly straightforward to implement.

Oh, that's a great news for me. Can you please add the required changes? I will be waiting for it.

  • font-size & font-style options as of now.

Thanks.

Nanda-albanero avatar Jan 25 '21 15:01 Nanda-albanero

I don't need the feature. So you would have to make a PR yourself I'm afraid.

johannesjo avatar Jan 25 '21 18:01 johannesjo

I've tried for it, couldn't get it to work. Can you share any sample snippet that could help me?

On Tue, Jan 26, 2021, 00:12 Johannes Millan [email protected] wrote:

I don't need the feature. So you would have to make a PR yourself I'm afraid.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannesjo/angular-material-css-vars/issues/60#issuecomment-767029324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR4YIEQ2H4BT544YHTNEVVDS3W3RDANCNFSM4WQSDAPA .

Nanda-albanero avatar Jan 26 '21 01:01 Nanda-albanero

I try to get back to you this weekend.

johannesjo avatar Jan 26 '21 08:01 johannesjo

Cool, thanks!

On Tue, Jan 26, 2021, 14:25 Johannes Millan [email protected] wrote:

I try to get back to you this weekend.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannesjo/angular-material-css-vars/issues/60#issuecomment-767398547, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR4YIEXSEKLOUPIVYJFJZLLS3Z7PJANCNFSM4WQSDAPA .

Nanda-albanero avatar Jan 27 '21 12:01 Nanda-albanero

You should find all the relevant code here: https://github.com/johannesjo/angular-material-css-vars/tree/master/projects/material-css-vars/src/lib

The relevant material part can be found here: node_modules/@angular/material/_theming.scss

You would need to play around with passing css variables instead of values to mat-typography-config like so:

$custom-typography: mat-typography-config(
  $font-family: var(--custom-font-family),
);
@include init-material-css-vars($typography-config: $custom-typography); 

johannesjo avatar Jan 30 '21 12:01 johannesjo

Thanks, I'll check it out.

On Sat, Jan 30, 2021, 17:32 Johannes Millan [email protected] wrote:

You should find all the relevant code here:

https://github.com/johannesjo/angular-material-css-vars/tree/master/projects/material-css-vars/src/lib

The relevant material part can be found here: node_modules/@angular/material/_theming.scss

You would need to play around with passing css variables instead of values to mat-typography-config like so:

$custom-typography: mat-typography-config( $font-family: var(--custom-font-family), ); @include init-material-css-vars($typography-config: $custom-typography);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johannesjo/angular-material-css-vars/issues/60#issuecomment-770201664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR4YIEXZ6TZSCJS2XAGDMBDS4PYNVANCNFSM4WQSDAPA .

Nanda-albanero avatar Jan 30 '21 12:01 Nanda-albanero

Same problem for me. I will try to find a solution for this. What I also need is a custom font selector (for different type of users) without loading a bulk of fonts for every user... it's always just one font needed. Let's keep in touch.

Do you may have any advice how to include custom font files dynamically?

muellerdberlin avatar Feb 05 '21 11:02 muellerdberlin

The solution is now fully described in the docs, so I'm closing this issue.

@muellerdberlin In Angular Material typography, it's not possible to provide paths to fonts (see the typography docs), so I don't see your feature request in the scope of this package. You should find a custom solution for this.

json-derulo avatar May 05 '23 13:05 json-derulo