Skip to content

Commit 4f246c0

Browse files
authored
Merge pull request #13587 from IgniteUI/simeonoff/configurable-font-size
refactor(theming): add option to configure base font-size
2 parents 7907443 + 5892dea commit 4f246c0

File tree

8 files changed

+38
-11
lines changed

8 files changed

+38
-11
lines changed

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22

33
All notable changes for each version of this project will be documented in this file.
44

5+
## 16.1.4
6+
### New Features
7+
- `Themes`:
8+
- **Experimental** - Added the ability to configure the base font-size used to calculate the rem values in all component themes. This allows for proper scaling of components when a different document font-size is used.
9+
10+
- Code example:
11+
12+
```scss
13+
// Configure the base font-size
14+
@use 'igniteui-theming/sass/config' as * with (
15+
$base-font-size: 10px // <-- 10px == 1rem
16+
);
17+
18+
// Standard imports and theme declarations
19+
@use 'igniteui-angular/src/lib/core/styles/themes' as *;
20+
21+
// This change also adds a new CSS variable `--ig-base-font-size`
22+
// that you can use to configure your own stylesheets:
23+
html {
24+
font-size: var(--ig-base-font-size); // 10px
25+
}
26+
27+
@include core();
28+
@include typography();
29+
@include theme();
30+
```
31+
532
## 16.1.0
633
### New Features
734
- `IgxSelect`:

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@types/source-map": "0.5.2",
6868
"fflate": "^0.7.3",
6969
"hammerjs": "^2.0.8",
70-
"igniteui-theming": "^3.2.2",
70+
"igniteui-theming": "^3.3.0",
7171
"igniteui-trial-watermark": "^3.0.2",
7272
"lodash-es": "^4.17.21",
7373
"rxjs": "^6.6.7",

projects/igniteui-angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"igniteui-trial-watermark": "^3.0.2",
7777
"lodash-es": "^4.17.21",
7878
"uuid": "^9.0.0",
79-
"igniteui-theming": "^3.2.2",
79+
"igniteui-theming": "^3.3.0",
8080
"@igniteui/material-icons-extended": "^3.0.0"
8181
},
8282
"peerDependencies": {

projects/igniteui-angular/src/lib/core/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ export const formatCurrency = new CurrencyPipe(undefined).transform;
831831

832832
/** Converts pixel values to their rem counterparts for a base value */
833833
export const rem = (value: number | string) => {
834-
const base = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('font-size'))
834+
const base = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--ig-base-font-size'))
835835
return Number(value) / base;
836836
}
837837

Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
@import '../../../../projects/igniteui-angular/src/lib/core/styles/themes/index';
2-
@import '../../../styles/demo-theme';
3-

src/styles/_demo-theme.scss

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Configure the base font-size #optional
2+
@use 'igniteui-theming/sass/config' as * with ($base-font-size: 16px);
3+
// Standard imports
14
@use '../../projects/igniteui-angular/src/lib/core/styles/themes' as *;
25
@use 'variables' as *;
36
@use 'mixins' as *;

src/styles/styles.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
@use 'demo-theme' as *;
12
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
23
@import url('https://fonts.googleapis.com/css?family=Titillium+Web:300,400,600,700');
3-
@import 'demo-theme';
44

55
// Tests should always be imported last
66
// @import '../../projects/igniteui-angular/src/lib/core/styles/spec/index';

0 commit comments

Comments
 (0)