diff --git a/core/src/components/tab-button/tab-button.ios.scss b/core/src/components/tab-button/tab-button.ios.scss index 508b522ef19..e014d36ef71 100644 --- a/core/src/components/tab-button/tab-button.ios.scss +++ b/core/src/components/tab-button/tab-button.ios.scss @@ -2,13 +2,13 @@ @import "./tab-button.ios.vars"; :host { + --color: #{$tab-button-ios-text-color}; + --color-selected: #{$tabbar-ios-text-color-active}; + --background-focused: #{$tabbar-ios-background-color-focused}; + max-width: $tab-button-ios-max-width; font-size: $tab-button-ios-font-size; - color: $tab-button-ios-text-color; - - --color-selected: #{$tabbar-ios-text-color-active}; - --background-focused: #{$tabbar-ios-background-color-focused}; } .tab-button-native { diff --git a/core/src/components/tab-button/tab-button.md.scss b/core/src/components/tab-button/tab-button.md.scss index f5883aa5c13..a23f84a8ea1 100644 --- a/core/src/components/tab-button/tab-button.md.scss +++ b/core/src/components/tab-button/tab-button.md.scss @@ -5,14 +5,13 @@ // -------------------------------------------------- :host { + --color: #{$tab-button-md-text-color}; + --color-selected: #{$tabbar-md-text-color-active}; + --background-focused: #{$tabbar-md-background-color-focused}; + max-width: 168px; font-weight: $tab-button-md-font-weight; - - color: $tab-button-md-text-color; - - --color-selected: #{$tabbar-md-text-color-active}; - --background-focused: #{$tabbar-md-background-color-focused}; } .tab-button-native { diff --git a/core/src/components/tab-button/tab-button.scss b/core/src/components/tab-button/tab-button.scss index 727e6d53b19..412bd34525d 100644 --- a/core/src/components/tab-button/tab-button.scss +++ b/core/src/components/tab-button/tab-button.scss @@ -20,20 +20,15 @@ border: 0; text-decoration: none; - background: none; + + background: var(--background); + color: var( --color); user-select: none; box-sizing: border-box; } -:host(.ion-color) { - color: #{current-color(contrast)}; - - --color-selected: #{current-color(contrast)}; - --background-selected: #{current-color(shade)}; -} - :host(.focused) { background: var(--background-focused); } diff --git a/core/src/components/tabbar/tabbar.ios.scss b/core/src/components/tabbar/tabbar.ios.scss index 21b4ca527f4..86c34892c40 100644 --- a/core/src/components/tabbar/tabbar.ios.scss +++ b/core/src/components/tabbar/tabbar.ios.scss @@ -5,16 +5,17 @@ // -------------------------------------------------- :host { + // default color / background + --background: #{$tabbar-ios-background-color}; + --background-rgb: var(--ion-tabbar-translucent-background-color-rgb, 248, 248, 248); + --color: #{$tabbar-ios-text-color-active}; + justify-content: center; height: $tabbar-ios-height; border-top: $tabbar-ios-border; - --ion-color-base: #{$tabbar-ios-background-color}; - --ion-color-base-rgb: var(--ion-tabbar-translucent-background-color-rgb, 248, 248, 248); - --ion-color-contrast: #{$tabbar-ios-text-color-active}; - contain: strict; } diff --git a/core/src/components/tabbar/tabbar.md.scss b/core/src/components/tabbar/tabbar.md.scss index 87ca82107e7..5d090aab7c7 100644 --- a/core/src/components/tabbar/tabbar.md.scss +++ b/core/src/components/tabbar/tabbar.md.scss @@ -2,13 +2,14 @@ @import "./tabbar.md.vars"; :host { + // default color / background + --background: #{$tabbar-md-background-color}; + --color: #{$tabbar-md-text-color-active}; + height: $tabbar-md-height; border-top: $tabbar-md-border; - --ion-color-base: #{$tabbar-md-background-color}; - --ion-color-contrast: #{$tabbar-md-text-color-active}; - contain: strict; } @@ -18,7 +19,6 @@ ion-scroll { max-width: 650px; } - // TODO: REVIEW :host(.placement-top) .tab-button.tab-selected .tab-button-icon, :host(.placement-top) .tab-button.tab-selected .tab-button-text { diff --git a/core/src/components/tabbar/tabbar.scss b/core/src/components/tabbar/tabbar.scss index 20c971d48f6..b61bb6c2712 100644 --- a/core/src/components/tabbar/tabbar.scss +++ b/core/src/components/tabbar/tabbar.scss @@ -13,8 +13,14 @@ width: 100%; - background: #{current-color(base)}; - color: #{current-color(contrast)}; + background: var(--background); + color: var(--color); +} + +:host(.ion-color) ion-tab-button { + --background: #{current-color(base)}; + --color: #{current-color(contrast, .7)}; + --color-selected: #{current-color(contrast)}; } :host(.tabbar-hidden) { diff --git a/core/src/components/tabs/tabs.tsx b/core/src/components/tabs/tabs.tsx index 91ed21e655d..367e1765e3a 100644 --- a/core/src/components/tabs/tabs.tsx +++ b/core/src/components/tabs/tabs.tsx @@ -1,5 +1,6 @@ import { Build, Component, Element, Event, EventEmitter, Listen, Method, Prop, State } from '@stencil/core'; import { Color, Config, NavOutlet, RouteID, RouteWrite, TabbarLayout, TabbarPlacement } from '../../interface'; +import { createColorClasses } from '../../utils/theme'; @Component({ @@ -298,6 +299,12 @@ export class Tabs implements NavOutlet { return !!(selectedTab && selectedTab !== leavingTab && !this.transitioning); } + hostData() { + return { + class: createColorClasses(this.color) + }; + } + render() { const dom = [