fix(segment): segment in toolbar uses correct contrast (#26353)

resolves #26350
This commit is contained in:
Liam DeBeasi
2022-11-23 11:53:01 -05:00
committed by GitHub
parent 4b501fd00c
commit 5a243ccebc
14 changed files with 29 additions and 2 deletions

View File

@ -201,9 +201,15 @@
// Segment Button: Toolbar w/ Color // Segment Button: Toolbar w/ Color
// -------------------------------------------------- // --------------------------------------------------
// Do not use the global or local CSS variable if the toolbar has a color // Toolbar with Color, Checked
/**
* Use the contrast color as background since
* since the text color is the base color. Otherwise
* we will have contrast issues when using light/medium/dark
* palettes across light and dark mode.
*/
:host(.in-toolbar-color) .segment-button-indicator-background { :host(.in-toolbar-color) .segment-button-indicator-background {
background: #fff; background: #{current-color(contrast)};
} }
// Toolbar with Color, Default Segment // Toolbar with Color, Default Segment

View File

@ -31,6 +31,27 @@ test.describe('segment: toolbar', () => {
<ion-segment-button value="c" disabled="true">Third</ion-segment-button> <ion-segment-button value="c" disabled="true">Third</ion-segment-button>
</ion-segment> </ion-segment>
</ion-toolbar> </ion-toolbar>
<ion-toolbar color="light">
<ion-segment value="a">
<ion-segment-button value="a">First</ion-segment-button>
<ion-segment-button value="b">Second</ion-segment-button>
<ion-segment-button value="c" disabled="true">Third</ion-segment-button>
</ion-segment>
</ion-toolbar>
<ion-toolbar color="medium">
<ion-segment value="a">
<ion-segment-button value="a">First</ion-segment-button>
<ion-segment-button value="b">Second</ion-segment-button>
<ion-segment-button value="c" disabled="true">Third</ion-segment-button>
</ion-segment>
</ion-toolbar>
<ion-toolbar color="dark">
<ion-segment value="a">
<ion-segment-button value="a">First</ion-segment-button>
<ion-segment-button value="b">Second</ion-segment-button>
<ion-segment-button value="c" disabled="true">Third</ion-segment-button>
</ion-segment>
</ion-toolbar>
</ion-header> </ion-header>
`); `);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 29 KiB