Skip to content

Commit 42efd1a

Browse files
authored
feat(components): remove meta from themes and use adaptive-contrast (#15740)
1 parent 0627563 commit 42efd1a

File tree

14 files changed

+15
-58
lines changed

14 files changed

+15
-58
lines changed

projects/igniteui-angular/src/lib/core/styles/components/column-actions/_column-actions-theme.scss

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,15 @@
3737
}
3838

3939
$theme: digest-schema($column-actions-schema);
40-
$meta: map.get($theme, '_meta');
4140

4241
@if not($title-color) and $background-color {
43-
$title-color: text-contrast($background-color);
42+
$title-color: adaptive-contrast(var(--background-color));
4443
}
4544

4645
@return extend($theme, (
4746
name: $name,
4847
title-color: $title-color,
4948
background-color: $background-color,
50-
theme: map.get($schema, '_meta', 'theme'),
51-
_meta: map.merge(if($meta, $meta, ()), (
52-
variant: map.get($schema, '_meta', 'theme'),
53-
)),
5449
));
5550
}
5651

@@ -59,7 +54,7 @@
5954
/// @param {Map} $theme - The theme used to style the component.
6055
@mixin column-actions($theme) {
6156
@include css-vars($theme);
62-
$variant: map.get($theme, '_meta', 'variant');
57+
$variant: map.get($theme, '_meta', 'theme');
6358

6459
%column-actions-display {
6560
display: flex;

projects/igniteui-angular/src/lib/core/styles/components/divider/_divider-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,11 @@
3232
}
3333

3434
$theme: digest-schema($divider-schema);
35-
$meta: map.get($theme, '_meta');
3635

3736
@return extend($theme, (
3837
name: $name,
3938
color: $color,
4039
inset: $inset,
41-
theme: map.get($schema, '_meta', 'theme'),
42-
_meta: map.merge(if($meta, $meta, ()), (
43-
variant: map.get($schema, '_meta', 'theme'),
44-
)),
4540
));
4641
}
4742

@@ -51,7 +46,7 @@
5146
@mixin divider($theme) {
5247
@include css-vars($theme);
5348

54-
$variant: map.get($theme, '_meta', 'variant');
49+
$variant: map.get($theme, '_meta', 'theme');
5550

5651
%igx-divider-display {
5752
position: relative;

projects/igniteui-angular/src/lib/core/styles/components/grid/_pivot-data-selector-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,9 @@
2525
}
2626

2727
$theme: digest-schema($pivot-data-selector-schema);
28-
$meta: map.get($theme, '_meta');
2928

3029
@return extend($theme, (
3130
name: $name,
32-
theme: map.get($schema, '_meta', 'theme'),
33-
_meta: map.merge(if($meta, $meta, ()), (
34-
variant: map.get($schema, '_meta', 'theme')
35-
)),
3631
));
3732
}
3833

@@ -41,7 +36,7 @@
4136
/// @param {Map} $theme - The theme used to style the component.
4237
@mixin pivot-data-selector($theme) {
4338
@include css-vars($theme);
44-
$variant: map.get($theme, '_meta', 'variant');
39+
$variant: map.get($theme, '_meta', 'theme');
4540

4641
$chip-height-material: (
4742
comfortable: rem(22px),

projects/igniteui-angular/src/lib/core/styles/components/highlight/highlight-theme.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
$theme: digest-schema($highlight-schema);
4040

4141
@if not($resting-color) and $resting-background {
42-
$resting-color: text-contrast($resting-background);
42+
$resting-color: adaptive-contrast(var(--resting-background));
4343
}
4444

4545
@if not($active-color) and $active-background {
46-
$active-color: text-contrast($active-background);
46+
$active-color: adaptive-contrast(var(--active-background));
4747
}
4848

4949
@return extend($theme, (
@@ -53,7 +53,6 @@
5353
resting-color: $resting-color,
5454
active-background: $active-background,
5555
active-color: $active-color,
56-
theme: map.get($schema, '_meta', 'theme'),
5756
));
5857
}
5958

projects/igniteui-angular/src/lib/core/styles/components/icon/_icon-theme.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
color: $color,
4242
size: $size,
4343
disabled-color: $disabled-color,
44-
theme: map.get($schema, '_meta', 'theme'),
4544
));
4645
}
4746

projects/igniteui-angular/src/lib/core/styles/components/label/_label-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
name: $name,
3232
selector: $selector,
3333
color: $color,
34-
theme: map.get($schema, '_meta', 'theme'),
35-
variant: map.get($schema, '_meta', 'theme'),
3634
));
3735
}
3836

@@ -43,7 +41,7 @@
4341
// The --variant CSS produced by css-vars is needed also
4442
// when dynamically switching between the input `type` attribute.
4543
@include css-vars($theme);
46-
$variant: map.get($theme, 'variant');
44+
$variant: map.get($theme, '_meta', 'theme');
4745

4846
%label-base {
4947
@include ellipsis();

projects/igniteui-angular/src/lib/core/styles/components/overlay/_overlay-theme.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
name: $name,
3838
selector: $selector,
3939
background-color: $background-color,
40-
theme: map.get($schema, '_meta', 'theme'),
4140
));
4241
}
4342

projects/igniteui-angular/src/lib/core/styles/components/paginator/_paginator-theme.scss

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,16 @@
3838
}
3939

4040
$theme: digest-schema($grid-paginator-schema);
41-
$meta: map.get($theme, '_meta');
4241

4342
@if not($text-color) and $background-color {
44-
$text-color: text-contrast($background-color);
43+
$text-color: adaptive-contrast($background-color);
4544
}
4645

4746
@return extend($theme, (
4847
name: $name,
4948
text-color: $text-color,
5049
background-color: $background-color,
5150
border-color: $border-color,
52-
theme: map.get($schema, '_meta', 'theme'),
53-
_meta: map.merge(if($meta, $meta, ()), (
54-
variant: map.get($schema, '_meta', 'theme')
55-
)),
5651
));
5752
}
5853

@@ -62,7 +57,7 @@
6257
@mixin paginator($theme) {
6358
@include css-vars($theme);
6459

65-
$variant: map.get($theme, '_meta', 'variant');
60+
$variant: map.get($theme, '_meta', 'theme');
6661

6762
$paginator-padding-inline: (
6863
comfortable: rem(24px),

projects/igniteui-angular/src/lib/core/styles/components/progress/circular/_circular-theme.scss

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
}
4747

4848
$theme: digest-schema($circular-bar-schema);
49-
$meta: map.get($theme, '_meta');
5049

5150
$fill-color-default-start: map.get($theme, 'fill-color-default');
5251
$fill-color-default-end: map.get($theme, 'fill-color-default');
@@ -73,10 +72,6 @@
7372
fill-color-success: $fill-color-success,
7473
text-color: $text-color,
7574
diameter: $diameter,
76-
theme: map.get($schema, '_meta', 'theme'),
77-
_meta: map.merge(if($meta, $meta, ()), (
78-
variant: map.get($schema, '_meta', 'theme')
79-
)),
8075
));
8176
}
8277

@@ -94,7 +89,7 @@
9489
$diameter: calc(var(--circular-size) + var(--stroke-thickness));
9590
$radius: calc(var(--circular-size) / 2 - var(--stroke-thickness) * .5);
9691
$circumference: calc(#{$radius} * 2 * 3.1416);
97-
$variant: map.get($theme, '_meta', 'variant');
92+
$variant: map.get($theme, '_meta', 'theme');
9893

9994
%display-circular {
10095
--circular-size: calc(#{var-get($theme, 'diameter')} - var(--stroke-thickness));
@@ -136,7 +131,7 @@
136131

137132
%outer {
138133
stroke: var-get($theme, 'fill-color-default');
139-
134+
140135
@if $variant != 'bootstrap' {
141136
animation: igx-initial-dashoffset var(--_transition-duration) linear;
142137
} @else {
@@ -313,7 +308,7 @@
313308
%text--hidden {
314309
visibility: hidden;
315310
}
316-
311+
317312
%gradient-start {
318313
stop-color: var-get($theme, 'fill-color-default-end');
319314
}

projects/igniteui-angular/src/lib/core/styles/components/progress/linear/_linear-theme.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
$linear-bar-schema: if(map.has-key($schema, 'linear-bar'), map.get($schema, 'linear-bar'), $schema);
5353

5454
$theme: digest-schema($linear-bar-schema);
55-
$meta: map.get($theme, '_meta');
5655

5756
@if not($track-border-radius) {
5857
$track-border-radius: map.get($theme, 'track-border-radius');
@@ -71,10 +70,6 @@
7170
track-border-radius: $track-border-radius,
7271
track-height: $track-height,
7372
strip-size: $strip-size,
74-
theme: map.get($schema, '_meta', 'theme'),
75-
_meta: map.merge(if($meta, $meta, ()), (
76-
variant: map.get($schema, '_meta', 'theme')
77-
)),
7873
));
7974
}
8075

@@ -127,7 +122,7 @@ $easing-curves: (
127122
@mixin progress-linear($theme) {
128123
@include css-vars($theme);
129124

130-
$variant: map.get($theme, '_meta', 'variant');
125+
$variant: map.get($theme, '_meta', 'theme');
131126

132127
%display-linear {
133128
position: relative;

0 commit comments

Comments
 (0)