[AAE-16219] Theming for HxP is not working (#8894)

This commit is contained in:
Bartosz Sekula
2023-09-08 17:20:05 +02:00
committed by GitHub
parent ce881b7dcf
commit a1b39fb6dc
6 changed files with 61 additions and 30 deletions

View File

@@ -22,3 +22,17 @@ $custom-theme: mat-light-theme(
@if $text-color { @if $text-color {
$custom-theme: get-custom-text-color($text-color, $custom-theme); $custom-theme: get-custom-text-color($text-color, $custom-theme);
} }
@if $base-font-size {
body,
html {
font-size: $base-font-size;
}
}
@if $font-family {
body,
html {
font-family: $font-family;
}
}

View File

@@ -1,7 +1,6 @@
@use 'sass:map'; @use 'sass:map';
@use 'sass:math'; @use 'sass:math';
@use 'sass:color'; @use 'sass:color';
@use '../../colors';
@function multiply($fore, $back) { @function multiply($fore, $back) {
$red: color.red($back) * color.red($fore) / 255; $red: color.red($back) * color.red($fore) / 255;

View File

@@ -1,5 +1,5 @@
@use '@angular/material' as mat; @use '@angular/material' as mat;
@import '../../colors'; @import './default-colors.scss';
@import './custom-palette-creator.scss'; @import './custom-palette-creator.scss';
@function get-mat-palettes($primary-color, $accent-color) { @function get-mat-palettes($primary-color, $accent-color) {
@@ -9,7 +9,7 @@
$custom-theme-primary-palette: create-color-palette($primary-color, 'primary'); $custom-theme-primary-palette: create-color-palette($primary-color, 'primary');
$mat-primary-palette: mat.define-palette($custom-theme-primary-palette, 500); $mat-primary-palette: mat.define-palette($custom-theme-primary-palette, 500);
} @else { } @else {
$mat-primary-palette: mat.define-palette($aca-primary-blue, A100); $mat-primary-palette: mat.define-palette($default-primary, A100);
} }
$mat-accent-palette: null; $mat-accent-palette: null;
@@ -18,14 +18,14 @@
$custom-theme-accent-palette: create-color-palette($accent-color, 'accent'); $custom-theme-accent-palette: create-color-palette($accent-color, 'accent');
$mat-accent-palette: mat.define-palette($custom-theme-accent-palette, 500); $mat-accent-palette: mat.define-palette($custom-theme-accent-palette, 500);
} @else { } @else {
$mat-accent-palette: mat.define-palette($aca-accent-green, A200); $mat-accent-palette: mat.define-palette($default-accent);
} }
$mat-warn-palette: mat.define-palette($aca-warn, A100); $mat-warn-palette: mat.define-palette($default-warn, A100);
@return ( @return (
primary: $mat-primary-palette, primary: $mat-primary-palette,
accent: $mat-accent-palette, accent: $mat-accent-palette,
warning: $mat-warn-palette, warning: $mat-warn-palette,
) );
} }

View File

@@ -0,0 +1,26 @@
/*
This file can be replaced by file with your default palettes.
In order to generate material theme, we need to provide three palettes, 'primary', 'accent' and 'warnign'.
If user would like to dynamically create only one palette, e.g. 'primary', in that case we need to provide
remaining palettes.
e.g.
@use '@angular/material' as mat;
$default-primary: mat.$indigo-palette;
$default-accent: $my-custom-palette;
$default-warn: (
50: #35041e,
100: #dd68a8,
contrast: (
...
),
*/
@use '@angular/material' as mat;
$default-primary: mat.$indigo-palette;
$default-accent: mat.$pink-palette;
$default-warn: mat.$red-palette;

View File

@@ -1,5 +1,11 @@
/* /*
Specify theme parameters e.g.: Replace 'THEME_CONFIGURATION' placeholder with your theme configuration using '$theme-config' variable map.
Specify colors for palettes generation, e.g. if for 'primaryColor' the color is going to be 'red'(#fc0313).
Then, we are going to generate 'primary' palette based on the 'red' color.
Geenerated pallete is going to be used to create material design theme
e.g.
$theme-config: ( $theme-config: (
primaryColor: #5175d2, primaryColor: #5175d2,

View File

@@ -1,6 +1,6 @@
@use 'sass:map'; @use 'sass:map';
@use '@angular/material' as mat; @use '@angular/material' as mat;
@import "../variables/font-family.scss"; @import '../variables/font-family';
@function get-mat-typography($base-font-size, $font-family) { @function get-mat-typography($base-font-size, $font-family) {
$custom-typography: mat.define-typography-config( $custom-typography: mat.define-typography-config(
@@ -77,17 +77,3 @@
'theme-adf-task-title-font-size': 1.28rem 'theme-adf-task-title-font-size': 1.28rem
); );
} }
@mixin base-font-size($font-size) {
html,
body {
font-size: $font-size !important;
}
}
@mixin base-font-family($font-family) {
html,
body {
font-family: $font-family !important;
}
}