Skip to content

Commit 4d8aff0

Browse files
feat(theming): add a global --ion-placeholder-opacity variable (#28944)
Issue number: internal --------- ## What is the current behavior? Developers are unable to globally change the placeholder opacity for inputs, textareas, searchbars, and selects. This becomes particularly problematic when trying to apply a high contrast theme. ## What is the new behavior? - Adds the `--ion-placeholder-opacity` with a fallback of `0.6` (this fallback is unchanged) - Sets the `--ion-placeholder-opacity` to `0.8` for the high contrast light & dark themes > [!NOTE] > The ticket says to update the standard light and dark themes to define `--ion-placeholder-opacity: 0.6`, however, I did not do this because this is not different than the fallback and therefore does not need to be defined. ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information Documentation pull request: ionic-team/ionic-docs#3421
1 parent c487dac commit 4d8aff0

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

core/src/css/themes/high-contrast-dark.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ $colors: (
9797
--ion-color-#{$color-name}-shade: #{map.get($value, shade)};
9898
--ion-color-#{$color-name}-tint: #{map.get($value, tint)};
9999
}
100+
101+
--ion-placeholder-opacity: 0.8;
100102
}
101103

102104
// Toast

core/src/css/themes/high-contrast-light.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ $colors: (
8888
--ion-color-#{$color-name}-shade: #{map.get($value, shade)};
8989
--ion-color-#{$color-name}-tint: #{map.get($value, tint)};
9090
}
91+
92+
--ion-placeholder-opacity: 0.8;
9193
}
9294

9395
// Toast

core/src/themes/ionic.globals.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $screen-breakpoints: (
3535
// Input placeholder opacity
3636
// Ensures that the placeholder has the
3737
// correct color contrast against the background.
38-
$placeholder-opacity: 0.6 !default;
38+
$placeholder-opacity: var(--ion-placeholder-opacity, 0.6) !default;
3939

4040
$form-control-label-margin: 16px !default;
4141

0 commit comments

Comments
 (0)