mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix color inheritance, core components should not contain colors
This commit is contained in:
@@ -3,23 +3,102 @@
|
||||
@import "../button-clear";
|
||||
@import "../button-fab";
|
||||
@import "../button-icon";
|
||||
@import "../button-outline";
|
||||
@import "../button-size";
|
||||
|
||||
// iOS Button (largely the core button styles)
|
||||
// iOS Button
|
||||
// --------------------------------------------------
|
||||
|
||||
$button-ios-color: map-get($colors-ios, primary) !default;
|
||||
$button-ios-color-activated: color-shade($button-ios-color) !default;
|
||||
$button-ios-text-color: inverse($button-ios-color) !default;
|
||||
$button-ios-hover-opacity: 0.8 !default;
|
||||
|
||||
|
||||
.button {
|
||||
background: $button-ios-color;
|
||||
color: $button-ios-text-color;
|
||||
|
||||
&:hover:not(.disable-hover) {
|
||||
opacity: $button-ios-hover-opacity;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&.activated {
|
||||
opacity: 1;
|
||||
background-color: $button-ios-color-activated;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.button-block {
|
||||
// This fixes an issue with flexbox and button on iOS Safari. See #225
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
||||
// Clear Button
|
||||
// --------------------------------------------------
|
||||
|
||||
.button-clear {
|
||||
color: color-shade($button-ios-color);
|
||||
|
||||
&:hover:not(.disable-hover) {
|
||||
opacity: 0.6;
|
||||
color: color-shade($button-ios-color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Outline Button
|
||||
// --------------------------------------------------
|
||||
|
||||
.button-outline {
|
||||
border: 1px solid $button-ios-color;
|
||||
background: transparent;
|
||||
color: $button-ios-color;
|
||||
|
||||
&.activated {
|
||||
opacity: 1;
|
||||
color: $background-ios-color;
|
||||
background-color: $button-ios-color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Default Button Color Mixin
|
||||
// --------------------------------------------------
|
||||
|
||||
@mixin button-default($bg-color, $bg-color-activated, $fg-color) {
|
||||
background-color: $bg-color;
|
||||
color: $fg-color;
|
||||
|
||||
&.activated {
|
||||
background-color: $bg-color-activated;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Generate Default Button Colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-value in $colors-ios {
|
||||
|
||||
.button-#{$color-name} {
|
||||
$bg-color: $color-value;
|
||||
$bg-color-activated: color-shade($bg-color);
|
||||
$fg-color: inverse($bg-color);
|
||||
@include button-default($bg-color, $bg-color-activated, $fg-color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Generate Clear Button Colors
|
||||
// --------------------------------------------------
|
||||
|
||||
// TODO primary activated is wrong
|
||||
@each $color-name, $color-value in $colors {
|
||||
@each $color-name, $color-value in $colors-ios {
|
||||
|
||||
$fg-color: color-shade($color-value);
|
||||
|
||||
@@ -52,7 +131,7 @@
|
||||
color: $fg-color;
|
||||
|
||||
&.activated {
|
||||
color: $background-color;
|
||||
color: $background-ios-color;
|
||||
background-color: $fg-color;
|
||||
}
|
||||
|
||||
@@ -62,7 +141,7 @@
|
||||
// Outline Clear Button Colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-value in $colors {
|
||||
@each $color-name, $color-value in $colors-ios {
|
||||
|
||||
.button-outline-#{$color-name} {
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
@import "../button-clear";
|
||||
@import "../button-fab";
|
||||
@import "../button-icon";
|
||||
@import "../button-outline";
|
||||
@import "../button-size";
|
||||
|
||||
// Material Design Button
|
||||
@@ -25,6 +24,11 @@ $button-md-clear-active-background-color: rgba(158, 158, 158, 0.2) !default;
|
||||
$button-md-fab-box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.14), 0 4px 5px rgba(0, 0, 0, 0.1) !default;
|
||||
$button-md-fab-box-shadow-active: 0 5px 15px 0 rgba(0, 0, 0, 0.4), 0 4px 7px 0 rgba(0, 0, 0, 0.1) !default;
|
||||
|
||||
$button-md-color: map-get($colors-md, primary) !default;
|
||||
$button-md-color-activated: color-shade($button-md-color) !default;
|
||||
$button-md-text-color: inverse($button-md-color) !default;
|
||||
$button-md-hover-opacity: 0.8 !default;
|
||||
|
||||
|
||||
.button {
|
||||
border-radius: $button-md-border-radius;
|
||||
@@ -93,7 +97,7 @@ $button-md-fab-box-shadow-active: 0 5px 15px 0 rgba(0, 0, 0, 0.4), 0 4p
|
||||
}
|
||||
|
||||
md-ripple {
|
||||
background: rgba( red($button-color), green($button-color), blue($button-color), 0.1);
|
||||
background: rgba( red($button-md-color), green($button-md-color), blue($button-md-color), 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +112,22 @@ $button-md-fab-box-shadow-active: 0 5px 15px 0 rgba(0, 0, 0, 0.4), 0 4p
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Outline Button
|
||||
// --------------------------------------------------
|
||||
|
||||
.button-outline {
|
||||
border: 1px solid $button-md-color;
|
||||
background: transparent;
|
||||
color: $button-md-color;
|
||||
|
||||
&.activated {
|
||||
opacity: 1;
|
||||
color: $background-md-color;
|
||||
background-color: $button-md-color;
|
||||
}
|
||||
}
|
||||
|
||||
// Material Design Button Color Mixin
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -138,7 +158,7 @@ $button-md-fab-box-shadow-active: 0 5px 15px 0 rgba(0, 0, 0, 0.4), 0 4p
|
||||
// Generate Material Design Button Auxiliary Colors
|
||||
// --------------------------------------------------
|
||||
|
||||
@each $color-name, $color-value in $colors {
|
||||
@each $color-name, $color-value in $colors-md {
|
||||
|
||||
@include button-theme-md($color-name, $color-value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user