An icon can be used in place of text. We're using the [Foundation icon font](http://zurb.com/playground/foundation-icon-fonts-3) here, but any icon fonts or image-based icons will work fine.
```html_example
-<span class="info badge"><i class="fi-share"></i></span>
+<span class="secondary badge"><i class="fi-share"></i></span>
<span class="success badge"><i class="fi-check"></i></span>
<span class="warning badge"><i class="fi-wrench"></i></span>
```
/// Colors used for buttons, callouts, links, etc. There must always be a color called `primary`.
/// @type Map
$foundation-palette: (
- primary: #1a7cbd,
+ primary: #1779ba,
secondary: #767676,
success: #3adb76,
warning: #ffae00,
/// Default text color for items in a Menu.
/// @type Color
-$accordion-item-color: foreground($accordion-background, $primary-color) !default;
+$accordion-item-color: pick-best-color($accordion-background, ($primary-color, $white)) !default;
/// Default background color on hover for items in a Menu.
/// @type Color
/// Default text color of tab content.
/// @type Color
-$accordion-content-color: foreground($accordion-content-background, $body-font-color) !default;
+$accordion-content-color: pick-best-color($accordion-content-background, ($body-font-color, $white)) !default;
/// Default padding for tab content.
/// @type Number | List
/// Default text color for badges.
/// @type Color
-$badge-color: foreground($badge-background) !default;
+$badge-color: pick-best-color($badge-background) !default;
/// Default padding inside badges.
/// @type Number
@if $name != primary {
&.#{$name} {
background: $color;
- color: foreground($color);
+ color: pick-best-color($color, ($white, $black));
}
}
}
/// Font color for buttons.
/// @type List
-$button-color: $white !default;
-
-/// Font color for buttons, if the background is light.
-/// @type List
-$button-color-alt: $black !default;
+$button-color: pick-best-color($button-background) !default;
/// Border radius for buttons, defaulted to global-radius.
/// @type Number
$background-hover-lightness: $button-background-hover-lightness
) {
@if $color == auto {
- $color: pick-best-color($base: $background, $colors: ($button-color, $button-color-alt));
+ $color: pick-best-color($base: $background, $colors: ($white, $black));
}
@if $background-hover == auto {
/// Default text color for labels.
/// @type Color
-$label-color: foreground($label-background) !default;
+$label-color: pick-best-color($label-background) !default;
/// Default font size for labels.
/// @type Number
@if $name != primary {
&.#{$name} {
background: $color;
- color: foreground($color);
+ color: pick-best-color($color, ($black, $white));
}
}
}
padding: $orbit-caption-padding;
background-color: $orbit-caption-background;
- color: foreground($orbit-caption-background);
+ color: color-pick-contrast($orbit-caption-background);
}
/// Adds base styles for the next/previous buttons in an Orbit slider. These styles are shared between the `.orbit-next` and `.orbit-previous` classes in the default CSS.
/// Text color of the pagination item for the current page.
/// @type Color
-$pagination-item-color-current: foreground($pagination-item-background-current) !default;
+$pagination-item-color-current: pick-best-color($pagination-item-background-current) !default;
/// Text color of a disabled pagination item.
/// @type Color
/// @type Color
$tab-background: $white !default;
-/// active background color of a tab bar.
+/// Font color of tab item.
+/// @type Color
+$tab-color: pick-best-color($tab-background, ($primary-color, $white)) !default;
+
+/// Active background color of a tab bar.
/// @type Color
$tab-background-active: $light-gray !default;
+/// Active font color of tab item.
+/// @type Color
+$tab-background-active-color: pick-best-color($tab-background-active, ($primary-color, $white)) !default;
+
/// Font size of tab items.
/// @type Number
$tab-item-font-size: rem-calc(12) !default;
/// Default text color of tab content.
/// @type Color
-$tab-content-color: foreground($tab-background, $primary-color) !default;
+$tab-content-color: pick-best-color($tab-content-background) !default;
/// Default padding for tab content.
/// @type Number | List
}
/// Adds styles for the links within a tab container. Apply this to the `<li>` elements inside a tab container.
-@mixin tabs-title {
+@mixin tabs-title (
+ $padding: $tab-item-padding,
+ $font-size: $tab-item-font-size,
+ $color: $tab-color,
+ $color-active: $tab-background-active-color,
+ $background-hover: $tab-item-background-hover,
+ $background-active: $tab-background-active
+) {
float: #{$global-left};
> a {
display: block;
- padding: $tab-item-padding;
- font-size: $tab-item-font-size;
+ padding: $padding;
+ font-size: $font-size;
line-height: 1;
+ color: $color;
&:hover {
background: $tab-item-background-hover;
&:focus,
&[aria-selected='true'] {
background: $tab-background-active;
+ color: $tab-background-active-color;
}
}
}
/// Adds styles for the wrapper that surrounds a tab group's content panes.
-@mixin tabs-content {
- border: 1px solid $tab-content-border;
+@mixin tabs-content (
+ $background: $tab-content-background,
+ $color: $tab-content-color,
+ $border-color: $tab-content-border
+) {
+ border: 1px solid $border-color;
border-top: 0;
- background: $tab-content-background;
+ background: $background;
+ color: $color;
transition: all 0.5s ease;
}
background: $primary-color;
> li > a {
- color: foreground($primary-color);
+ color: pick-best-color($primary-color);
&:hover,
&:focus {
$global-width: rem-calc(1200);
$global-lineheight: 1.5;
$foundation-palette: (
- primary: #1a7cbd,
+ primary: #1779ba,
secondary: #767676,
success: #3adb76,
warning: #ffae00,
$accordion-background: $white;
$accordion-plusminus: true;
$accordion-title-font-size: rem-calc(12);
-$accordion-item-color: foreground($accordion-background, $primary-color);
+$accordion-item-color: pick-best-color($accordion-background, ($primary-color, $white));
$accordion-item-background-hover: $light-gray;
$accordion-item-padding: 1.25rem 1rem;
$accordion-content-background: $white;
$accordion-content-border: 1px solid $light-gray;
-$accordion-content-color: foreground($accordion-content-background, $body-font-color);
+$accordion-content-color: pick-best-color($accordion-content-background, ($body-font-color, $white));
$accordion-content-padding: 1rem;
// 8. Accordion Menu
// --------
$badge-background: $primary-color;
-$badge-color: foreground($badge-background);
+$badge-color: pick-best-color($badge-background);
$badge-padding: 0.3em;
$badge-minwidth: 2.1em;
$badge-font-size: 0.6rem;
$button-fill: solid;
$button-background: $primary-color;
$button-background-hover: scale-color($button-background, $lightness: -15%);
-$button-color: $white;
-$button-color-alt: $black;
+$button-color: pick-best-color($button-background);
$button-radius: $global-radius;
$button-sizes: (
tiny: 0.6rem,
// ---------
$label-background: $primary-color;
-$label-color: foreground($label-background);
+$label-color: pick-best-color($label-background);
$label-font-size: 0.8rem;
$label-padding: 0.33333rem 0.5rem;
$label-radius: $global-radius;
$pagination-radius: $global-radius;
$pagination-item-background-hover: $light-gray;
$pagination-item-background-current: $primary-color;
-$pagination-item-color-current: foreground($pagination-item-background-current);
+$pagination-item-color-current: pick-best-color($pagination-item-background-current);
$pagination-item-color-disabled: $medium-gray;
$pagination-ellipsis-color: $black;
$pagination-mobile-items: false;
$tab-margin: 0;
$tab-background: $white;
+$tab-color: pick-best-color($tab-background, ($primary-color, $white));
$tab-background-active: $light-gray;
+$tab-background-active-color: pick-best-color($tab-background-active, ($primary-color, $white));
$tab-item-font-size: rem-calc(12);
$tab-item-background-hover: $white;
$tab-item-padding: 1.25rem 1.5rem;
$tab-expand-max: 6;
$tab-content-background: $white;
$tab-content-border: $light-gray;
-$tab-content-color: foreground($tab-background, $primary-color);
+$tab-content-color: pick-best-color($tab-content-background);
$tab-content-padding: 1rem;
// 33. Thumbnail
/// @param {Color} $color2 - Second color to compare.
///
/// @returns {Number} The contrast ratio of the compared colors.
-@function pick-best-color($base, $colors: ($button-color, $button-color-alt), $tolerance: 0) {
+@function pick-best-color($base, $colors: ($white, $black), $tolerance: 0) {
$contrast: color-contrast($base, nth($colors, 1));
$best: nth($colors, 1);
@include test-module('Color') {
@include test('Foreground (Black) [function]') {
- $test: foreground($white);
+ $test: pick-best-color($white);
$expect: $black;
@include assert-equal($test, $expect,
}
@include test('Foreground (White) [function]') {
- $test: foreground($black);
+ $test: pick-best-color($black);
$expect: $white;
@include assert-equal($test, $expect,