Skip to content

Commit a2fedd0

Browse files
committed
Merge branch 'next' into FW-6252-badge
2 parents fdfeaad + 207d485 commit a2fedd0

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

core/src/themes/functions.color.scss

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,20 @@
3939

4040
$value: map.get($values, $variation);
4141

42-
// If the color requested is subtle we return `--ion-color-primary-subtle-contrast`
43-
// Otherwise we return `--ion-color-primary-contrast`
42+
// TODO(FW-6417): this can be removed when foreground is required
43+
// Fallback to "base" variant when "foreground" variant is undefined
44+
@if ($variation == foreground and $value == null) {
45+
$variation: base;
46+
$value: map.get($values, $variation);
47+
}
48+
49+
// If the color requested is subtle we return `--ion-color-{color}-subtle-contrast`,
50+
// otherwise we return `--ion-color-{color}-contrast`.
4451
$variable: if($subtle, "--ion-color-#{$name}-subtle-#{$variation}", "--ion-color-#{$name}-#{$variation}");
4552

46-
// If the variation being used is base, we do not include the variant so
47-
// If the color requested is subtle we return `--ion-color-primary-subtle`
48-
// Otherwise we return `--ion-color-primary`
53+
// If the variation being used is "base", we do not include the variant.
54+
// If the color requested is subtle we return `--ion-color-{color}-subtle`,
55+
// otherwise we return `--ion-color-{color}`.
4956
@if ($variation == base) {
5057
$variable: if($subtle, "--ion-color-#{$name}-subtle", "--ion-color-#{$name}");
5158
}
@@ -134,10 +141,9 @@
134141
$hue-colors: map.get($theme-colors, $color-name);
135142
$color-variants: map.get($hue-colors, $hue);
136143

137-
// Determine prefix based on hue value
138144
$prefix: if($hue == "subtle", "-subtle", "");
139145

140-
// TODO this @if can be removed if we add subtle colors for ios and md
146+
// TODO(FW-6417) this @if can be removed if we add subtle colors for ios and md
141147
// Only proceed if the color variants exist
142148
@if $color-variants {
143149
// Grab the individual color variants
@@ -159,7 +165,7 @@
159165
) !important;
160166
--ion-color#{$prefix}-shade: var(--ion-color-#{$color-name}#{$prefix}-shade, #{$shade}) !important;
161167
--ion-color#{$prefix}-tint: var(--ion-color-#{$color-name}#{$prefix}-tint, #{$tint}) !important;
162-
// TODO(): remove the fallback variable when the foreground variable is
168+
// TODO(FW-6417): remove the fallback variable when the foreground variable is
163169
// required by all palettes for all themes:
164170
// --ion-color#{$prefix}-foreground: var(--ion-color-#{$color-name}#{$prefix}-foreground, #{$foreground}) !important;
165171
--ion-color#{$prefix}-foreground: var(
@@ -235,7 +241,7 @@
235241
--ion-color-#{$color-name}#{$prefix}-contrast-rgb: #{map.get($colors, contrast-rgb)};
236242
--ion-color-#{$color-name}#{$prefix}-shade: #{map.get($colors, shade)};
237243
--ion-color-#{$color-name}#{$prefix}-tint: #{map.get($colors, tint)};
238-
// TODO(): this "if" can be removed when foreground is defined for ios/md
244+
// TODO(FW-6417): this "if" can be removed when foreground is defined for ios/md
239245
// themes. It should not be added until we want foreground to be required for
240246
// ios and md because this will be a breaking change, requiring users to add
241247
// `--ion-color-{color}-foreground` in order to override the default colors

core/src/themes/native/test/colors/index.html

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

4848
.ion-color {
49-
color: var(--ion-color-base);
49+
color: var(--ion-color-foreground);
5050
}
5151

5252
.ion-color-background {
@@ -66,17 +66,17 @@
6666

6767
.ion-color-background-08 {
6868
background: rgb(var(--ion-color-base-rgb), 0.08);
69-
color: var(--ion-color-base);
69+
color: var(--ion-color-foreground);
7070
}
7171

7272
.ion-color-background-12 {
7373
background: rgb(var(--ion-color-base-rgb), 0.12);
74-
color: var(--ion-color-base);
74+
color: var(--ion-color-foreground);
7575
}
7676

7777
.ion-color-background-16 {
7878
background: rgb(var(--ion-color-base-rgb), 0.16);
79-
color: var(--ion-color-base);
79+
color: var(--ion-color-foreground);
8080
}
8181
</style>
8282
</head>

0 commit comments

Comments
 (0)