Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(buttons): use theme toolbar colors for default iOS buttons #18191

Merged
merged 14 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/src/components/back-button/back-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,10 @@ ion-icon {

pointer-events: none;
}

// Back Button in Toolbar: Global Theming
// --------------------------------------------------

:host-context(ion-toolbar:not(.ion-color)):not(.ion-color) {
color: #{var(--ion-toolbar-color, var(--color))};
}
58 changes: 53 additions & 5 deletions core/src/components/buttons/buttons.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,75 @@
--border-radius: #{$toolbar-ios-button-border-radius};
}

// iOS Toolbar with Color Default Button
// iOS Toolbar with Color: Default Buttons
// --------------------------------------------------

:host-context(.ion-color)::slotted(*) .button {
--color: initial;
--border-color: initial;
--color-activated: initial;
}

:host-context(.ion-color)::slotted(*) .button-solid {
--background: #{current-color(contrast)};
--background-activated: #{current-color(contrast, .8)};
--background-focused: #{current-color(contrast, .6)};
--color: #{current-color(base)};
--color-focused: #{current-color(base)};
}

:host-context(.ion-color)::slotted(*) .button-clear {
--background-focused: #{current-color(contrast, .1)};
--color-activated: #{current-color(contrast)};
--color-focused: #{current-color(contrast)};
}

:host-context(.ion-color)::slotted(*) .button-outline {
--background-activated: #{current-color(contrast)};
--background-focused: #{current-color(contrast, .1)};
--color-activated: #{current-color(base)};
--color-focused: #{current-color(contrast)};
}


// iOS Toolbar Button Clear
// --------------------------------------------------

:host-context(ion-toolbar:not(.ion-color))::slotted(*) .button-clear {
--color: #{var(--ion-toolbar-color, ion-color(primary, base))};
--color-activated: #{$toolbar-ios-color-activated};
--color-focused: #{var(--ion-toolbar-color, ion-color(primary, base))};
}


// iOS Toolbar Button Outline
// --------------------------------------------------

:host-context(ion-toolbar:not(.ion-color))::slotted(*) .button-outline {
--color: #{var(--ion-toolbar-color, ion-color(primary, base))};
--color-activated: #{var(--ion-toolbar-background, ion-color(primary, contrast))};
--color-focused: #{var(--ion-toolbar-color, ion-color(primary, base))};
--border-color: #{var(--ion-toolbar-color, ion-color(primary, base))};
--background-activated: #{var(--ion-toolbar-color, ion-color(primary, base))};
}


// iOS Toolbar Button Solid
// --------------------------------------------------

@media (any-hover: hover) {
::slotted(*) .button-solid-ios:hover {
opacity: .4;
}
:host-context(ion-toolbar:not(.ion-color))::slotted(*) .button-solid {
--color: #{$toolbar-ios-background};
--color-activated: #{$toolbar-ios-background};
--color-focused: #{$toolbar-ios-background};
--background: #{var(--ion-toolbar-color, ion-color(primary, base))};
--background-activated: #{var(--ion-toolbar-color-activated, ion-color(primary, shade))};
--background-focused: #{var(--ion-toolbar-color-activated, ion-color(primary, shade))};
}


// iOS Toolbar Button Icon
// --------------------------------------------------

::slotted(*) ion-icon[slot="start"] {
@include margin(0);
@include margin-horizontal(null, .3em);
Expand Down
31 changes: 28 additions & 3 deletions core/src/components/buttons/buttons.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,35 @@
}


// Material Design Toolbar w/ Color Default Button
// Material Design Toolbar w/ Color: Default Buttons
// --------------------------------------------------

:host-context(.ion-color)::slotted(*) .button {
--color: initial;
--color-activated: initial;
--color-focused: initial;
--background-focused: #{ion-color(primary, contrast, 0.1)};
--background-focused: #{current-color(contrast, .1)};
}

:host-context(.ion-color)::slotted(*) .button-solid {
--background: #{current-color(contrast)};
--background-activated: #{current-color(contrast)};
--background-focused: #{current-color(contrast, .9)};
--color: #{current-color(base)};
--color-focused: #{current-color(base)};
}

:host-context(.ion-color)::slotted(*) .button-outline {
--border-color: #{current-color(contrast)};
}


// Material Design Toolbar Default Button
// --------------------------------------------------

::slotted(*) .button {
--color-focused: #{$toolbar-md-color};
--background-focused: rgba(66, 66, 66, 0.1);
}


Expand All @@ -39,8 +60,10 @@
::slotted(*) .button-solid {
--color: #{$toolbar-md-background};
--color-activated: #{$toolbar-md-background};
--color-focused: #{$toolbar-md-background};
--background: #{$toolbar-md-color};
--background-activated: #{$toolbar-md-color};
--background-focused: #{$toolbar-md-color-activated};
}


Expand All @@ -50,9 +73,11 @@
::slotted(*) .button-outline {
--color: initial;
--color-activated: currentColor;
--color-focused: #{$toolbar-md-color};
--background: transparent;
--background-activated: transparent;
--border-color: currentColor;
--border-color: #{$toolbar-md-color};
--background-focused: rgba(66, 66, 66, 0.1);
}


Expand Down
7 changes: 7 additions & 0 deletions core/src/components/menu-button/menu-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ ion-icon {
:host(.ion-color) .button-native {
color: current-color(base);
}

// Menu Button in Toolbar: Global Theming
// --------------------------------------------------

:host-context(ion-toolbar:not(.ion-color)) {
color: #{var(--ion-toolbar-color, var(--color))};
}
8 changes: 5 additions & 3 deletions core/src/components/segment/segment.ios.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,16 @@
line-height: $segment-button-ios-toolbar-line-height;
}

:host-context(ion-toolbar):not(.ion-color)::slotted(ion-segment-button) {
:host-context(ion-toolbar:not(.ion-color)):not(.ion-color)::slotted(ion-segment-button) {
border-color: #{var(--ion-toolbar-color-checked, var(--border-color))};

color: #{var(--ion-toolbar-color-unchecked, var(--color))};
}

:host-context(ion-toolbar):not(.ion-color)::slotted(.segment-button-checked) {
color: #{var(--ion-toolbar-color-checked, var(--color-checked))};
:host-context(ion-toolbar:not(.ion-color)):not(.ion-color)::slotted(.segment-button-checked) {
background: #{var(--ion-toolbar-color-checked, var(--background-checked))};

color: #{var(--ion-toolbar-background, var(--color-checked))};
}

// Segment: Color Toolbar
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/segment/segment.md.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
// Segment: Default Toolbar
// --------------------------------------------------

:host-context(ion-toolbar):not(.ion-color)::slotted(ion-segment-button) {
:host-context(ion-toolbar:not(.ion-color)):not(.ion-color)::slotted(ion-segment-button) {
color: #{var(--ion-toolbar-color-unchecked, var(--color))};
}

:host-context(ion-toolbar):not(.ion-color)::slotted(.segment-button-checked) {
:host-context(ion-toolbar:not(.ion-color)):not(.ion-color)::slotted(.segment-button-checked) {
--indicator-color-checked: #{var(--ion-toolbar-color-checked, var(--color-checked))};

color: #{var(--ion-toolbar-color-checked, var(--color-checked))};
Expand Down
1 change: 1 addition & 0 deletions core/src/components/toolbar/test/colors/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ion-icon slot="icon-only" name="add"></ion-icon>
</ion-button>
<ion-button fill="solid">Solid</ion-button>
<ion-button fill="outline">Outline</ion-button>
</ion-buttons>
<ion-buttons slot="primary">
<ion-button fill="clear">Clear</ion-button>
Expand Down
4 changes: 2 additions & 2 deletions core/src/themes/test/css-variables/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* https://ionicframework.com/docs/theming/color-generator
**/

:root {
/* :root {
brandyscarney marked this conversation as resolved.
Show resolved Hide resolved
--ion-color-primary: #3880ff;
--ion-color-primary-rgb: 56,128,255;
--ion-color-primary-contrast: #ffffff;
Expand Down Expand Up @@ -72,4 +72,4 @@
--ion-color-light-contrast-rgb: 0,0,0;
--ion-color-light-shade: #d7d8da;
--ion-color-light-tint: #f5f6f9;
}
} */
1 change: 1 addition & 0 deletions core/src/themes/test/css-variables/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button default-href="/"></ion-back-button>
<ion-menu-button auto-hide="false"></ion-menu-button>
<ion-button>Default</ion-button>
<ion-button fill="solid">Solid</ion-button>
<ion-button fill="clear">Clear</ion-button>
Expand Down