Skip to content

Commit 11e82c1

Browse files
authored
Merge pull request #6685 from IgniteUI/mpopov/typography-fix
fix(themes): do not set the global text color in igx-core
2 parents 3ce4d85 + 17ea346 commit 11e82c1

File tree

11 files changed

+99
-45
lines changed

11 files changed

+99
-45
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

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

5+
## 9.0.1
6+
- **Breaking Changes**
7+
- Remove `$base-color` from igx-typography. The igx-typography class now inherits the parent color.
8+
59
## 9.0.0
610

711
### General

projects/igniteui-angular/migrations/migration-collection.json

+5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
"version": "9.0.0",
6666
"description": "Updates Ignite UI for Angular from v8.2.x to v9.0.0",
6767
"factory": "./update-9_0_0"
68+
},
69+
"migration-14": {
70+
"version": "9.0.1",
71+
"description": "Updates Ignite UI for Angular from v9.0.0 to v9.0.1",
72+
"factory": "./update-9_0_1"
6873
}
6974
}
7075
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "../../common/schema/theme-props.schema.json",
3+
"changes": [
4+
{
5+
"name": "$base-color",
6+
"remove": true,
7+
"owner": "igx-typography"
8+
}
9+
]
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import * as path from 'path';
2+
3+
// tslint:disable:no-implicit-dependencies
4+
import { virtualFs } from '@angular-devkit/core';
5+
import { EmptyTree } from '@angular-devkit/schematics';
6+
// tslint:disable-next-line:no-submodule-imports
7+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
8+
9+
describe('Update 9.0.1', () => {
10+
let appTree: UnitTestTree;
11+
const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json'));
12+
const configJson = {
13+
defaultProject: 'testProj',
14+
projects: {
15+
testProj: {
16+
sourceRoot: '/testSrc'
17+
}
18+
},
19+
schematics: {
20+
'@schematics/angular:component': {
21+
prefix: 'appPrefix'
22+
}
23+
}
24+
};
25+
26+
beforeEach(() => {
27+
appTree = new UnitTestTree(new EmptyTree());
28+
appTree.create('/angular.json', JSON.stringify(configJson));
29+
});
30+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {
2+
Rule,
3+
SchematicContext,
4+
Tree
5+
} from '@angular-devkit/schematics';
6+
import { UpdateChanges } from '../common/UpdateChanges';
7+
8+
const version = '9.0.1';
9+
10+
export default function(): Rule {
11+
return (host: Tree, context: SchematicContext) => {
12+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
13+
14+
const update = new UpdateChanges(__dirname, host, context);
15+
update.applyChanges();
16+
};
17+
}

projects/igniteui-angular/src/lib/core/styles/base/utilities/_functions.scss

-4
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,6 @@
315315
$saturations: (50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 'A100', 'A200', 'A400', 'A700');
316316
$shades: (50: .02, 100: .04, 200: .08, 300: .12, 400: .26, 500: .38, 600: .54, 700: .62, 800: .74, 900: .87);
317317

318-
@if global-variable-exists('igx-foreground-color') and type-of($igx-foreground-color) == 'color' {
319-
$grays: $igx-foreground-color;
320-
}
321-
322318
$primary-palette: generate-palette($primary, $saturations);
323319
$secondary-palette: generate-palette($secondary, $saturations);
324320
$grayscale-palette: grayscale-palette($grays, $shades);

projects/igniteui-angular/src/lib/core/styles/themes/_core.scss

+1-4
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,14 @@
8080
@mixin igx-core(
8181
$print-layout: true,
8282
$direction: ltr,
83-
$foreground-color: rgba(0, 0, 0, .87)
8483
) {
8584
@if $direction != ltr and $direction != rtl {
8685
$direction: ltr !global;
8786
} @else {
8887
$direction: $direction !global;
8988
}
9089

91-
$igx-foreground-color: $foreground-color !global;
92-
93-
@include igx-typography($base-color: $foreground-color);
90+
@include igx-typography();
9491
@include igx-vhelper();
9592

9693
@if $print-layout == true {

projects/igniteui-angular/src/lib/core/styles/themes/_index.scss

+3-7
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@
497497
@include igx-typography(
498498
$font-family: "'Open Sans', Helvetica, Arial, sans-serif",
499499
$type-scale: $fluent-type-scale,
500-
$base-color: #323130
501500
);
502501

503502
@include igx-theme(
@@ -532,8 +531,7 @@
532531

533532
@include igx-typography(
534533
$font-family: "'Open Sans', Helvetica, Arial, sans-serif",
535-
$type-scale: $fluent-type-scale,
536-
$base-color: #fff
534+
$type-scale: $fluent-type-scale
537535
);
538536

539537
@include igx-theme(
@@ -569,8 +567,7 @@
569567

570568
@include igx-typography(
571569
$font-family: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
572-
$type-scale: $bootstrap-type-scale,
573-
$base-color: #212529
570+
$type-scale: $bootstrap-type-scale
574571
);
575572

576573
@include igx-calendar-typography($bootstrap-type-scale, $categories: (
@@ -632,8 +629,7 @@
632629

633630
@include igx-typography(
634631
$font-family: '-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
635-
$type-scale: $bootstrap-type-scale,
636-
$base-color: #fff
632+
$type-scale: $bootstrap-type-scale
637633
);
638634

639635
@include igx-calendar-typography($bootstrap-type-scale, $categories: (

projects/igniteui-angular/src/lib/core/styles/typography/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,13 @@ The typography mixin defines the global typography styles for an application, in
8484
It currently accepts 3 arguments:
8585
- `$font-family` - The global font family to be used by the application.
8686
- `$type-scale` - The default type scale to be used by the application.
87-
- `$base-color` - The base text color to be used by the application.
8887

8988
To overwrite the default typography, include the `igx-typography` mixin anywhere after the `igx-core` mixin. Let's take advantage of the type scale `$my-type-scale` we defined above and make it the default type scale.
9089

9190
```scss
9291
@include igx-typography(
9392
$font-family: "'Roboto', sans-serif",
94-
$type-scale: $my-type-scale,
95-
$base-color: #484848
93+
$type-scale: $my-type-scale
9694
);
9795
```
9896

projects/igniteui-angular/src/lib/core/styles/typography/_typography.scss

-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,9 @@
3636
/// default-type-scale will be used.
3737
/// @param {String} $font-family ["'Titillium Web', sans-serif"] - The font family to be used across all typographic elements.
3838
/// @param {Map} $type-scale [$default-type-scale] - A type scale map as produced by igx-type-scale.
39-
/// @param {String} $base-color [rgba(0, 0, 0, .74)] - The default color used across all typographic elements (Components define their own text colors).
4039
@mixin igx-typography(
4140
$font-family: "'Titillium Web', sans-serif",
4241
$type-scale: $default-type-scale,
43-
$base-color: $igx-foreground-color
4442
) {
4543
// Maps type scale typographic categories
4644
// to native elements.
@@ -64,7 +62,6 @@
6462
font-family: unquote($font-family);
6563
font-size: $browser-context;
6664
line-height: $browser-line-height;
67-
color: $base-color;
6865
font-size-adjust: 100%;
6966
-webkit-font-smoothing: antialiased;
7067
-moz-osx-font-smoothing: grayscale;

src/styles/igniteui-theme.scss

+28-24
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,43 @@
55
@import 'app-palettes';
66
@import 'app-layout';
77

8+
$igx-background-color: igx-color($default-palette, 'surface');
9+
$igx-foreground-color: text-contrast($igx-background-color);
10+
11+
body {
12+
background: $igx-background-color;
13+
color: #222;
14+
}
15+
816
@include igx-core($direction: ltr);
917

1018
/* autoprefixer grid: on */
11-
.default-theme {
12-
$igx-background-color: igx-color($default-palette, 'surface');
13-
$igx-foreground-color: text-contrast($igx-background-color);
1419

15-
background: $igx-background-color;
16-
color: $igx-foreground-color;
17-
18-
@include scrollbar-love();
19-
@include igx-theme($default-palette);
2020

21-
.nav-header {
22-
@include nav-logo('../assets/images/rsrcs/igniteui-logo-light-bg', $igx-background-color);
23-
}
24-
}
2521

26-
// .dark-theme {
27-
// $igx-background-color: igx-color($green-dark-palette, 'surface');
28-
// $igx-foreground-color: text-contrast($igx-background-color);
22+
@include scrollbar-love();
23+
@include igx-theme($default-palette);
2924

30-
// background: $igx-background-color;
31-
// color: $igx-foreground-color;
25+
.nav-header {
26+
@include nav-logo('../assets/images/rsrcs/igniteui-logo-light-bg', $igx-background-color);
27+
}
3228

33-
// @include scrollbar-love(lighten($igx-background-color, 15%));
34-
// @include igx-dark-theme($green-dark-palette);
35-
// @include igx-typography($font-family: 'sans-serif', $base-color: gray);
3629

37-
// .nav-header {
38-
// @include nav-logo('../assets/images/rsrcs/igniteui-logo-dark-bg', $igx-background-color);
39-
// }
40-
// }
30+
//.dark-theme {
31+
// $igx-background-color: igx-color($green-dark-palette, 'surface');
32+
// $igx-foreground-color: text-contrast($igx-background-color);
33+
//
34+
// background: $igx-background-color;
35+
// color: $igx-foreground-color;
36+
//
37+
// @include scrollbar-love(lighten($igx-background-color, 15%));
38+
// @include igx-dark-theme($green-dark-palette);
39+
// @include igx-typography($font-family: 'sans-serif');
40+
//
41+
// .nav-header {
42+
// @include nav-logo('../assets/images/rsrcs/igniteui-logo-dark-bg', $igx-background-color);
43+
// }
44+
//}
4145

4246
// .bootstrap-theme {
4347
// $igx-background-color: igx-color($bootstrap-palette, 'surface');

0 commit comments

Comments
 (0)