Add color classes to give badges additional meaning.
```html_example
-<span class="badge">1</span>
+<span class="badge primary">1</span>
<span class="badge secondary">2</span>
<span class="badge success">3</span>
<span class="badge alert">A</span>
<span class="badge warning">B</span>
```
-<br>
+---
+
+### Custom Colors
+
+If you're using the Sass version of Foundation, you can customize the badge classes by editing the `$badge-palette` map in your settings file. The badge palette defaults to `$foundation-palette`.
+
+If you don't need certain colors from the default palette, simply remove them from the list.
+
+```scss
+$badge-palette: map-remove($foundation-palette, (
+ primary,
+ secondary
+)) !default;
+```
+
+Or you can add more colors to the default palette.
+
+```scss
+$badge-palette: map-merge($foundation-palette, (
+ purple: #bb00ff
+)) !default;
+```
+
+Or you can define your own custom badge palette.
+
+```scss
+$badge-palette: (
+ black: #000000,
+ red: #ff0000,
+ purple: #bb00ff
+) !default;
+```
+
+---
-The `$badge-classes` list in your settings file determines which colors in `$foundation-palette` will generate color classes. If you don't need a certain badge class, simply remove it from the list.
+### Text Colors
The text color for each badge class is determined by either `$badge-color` or `$badge-color-alt`, whichever settings variable has more contrast.
---
-### With Icons
+## Icons
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.
Add color classes to give buttons additional meaning.
```html_example
-<a class="button" href="#">Primary</a>
+<a class="button primary" href="#">Primary</a>
<a class="button secondary" href="#">Secondary</a>
<a class="button success" href="#">Success</a>
<a class="button alert" href="#">Alert</a>
<a class="button warning" href="#">Warning</a>
-<a class="button disabled" href="#">Disabled</a>
```
-The `$button-classes` list in your settings file determines which colors in `$foundation-palette` will generate color classes. If you don't need a certain button class, simply remove it from the list.
+---
+
+### Custom Colors
+
+If you're using the Sass version of Foundation, you can customize the button classes by editing the `$button-palette` map in your settings file. The button palette defaults to `$foundation-palette`.
+
+If you don't need certain colors from the default palette, simply remove them from the list.
+
+```scss
+$button-palette: map-remove($foundation-palette, (
+ primary,
+ secondary
+)) !default;
+```
+
+Or you can add more colors to the default palette.
+
+```scss
+$button-palette: map-merge($foundation-palette, (
+ purple: #bb00ff
+)) !default;
+```
+
+Or you can define your own custom button palette.
+
+```scss
+$button-palette: (
+ black: #000000,
+ red: #ff0000,
+ purple: #bb00ff
+) !default;
+```
+
+---
+
+### Text Colors
The text color for each button class is determined by either `$button-color` or `$button-color-alt`, whichever settings variable has more contrast.
<p>The default settings meet WCAG 2.0 level AA contrast requirements. Be sure to [check the contrast](http://webaim.org/resources/contrastchecker/) when changing color variables. To give all buttons the same color text, set `$button-color` and `$button-color-alt` to the same value — but know that doing so may decrease accessibility.</p>
</div>
+---
+
+### Disabled Buttons
+
The `.disabled` class will give buttons a faded appearance. The class is a purely visual style, and won't actually disable a control. For `<button>` elements, you can add the `disabled` attribute to both disable and style it. If you want to disable a link, you should add the `aria-disabled` attribute to mark it as disabled for assistive technology.
+
+```html_example
+<button type="button" class="button" disabled>Disabled</button>
+<a class="button disabled" href="#" aria-disabled>Disabled</a>
+```
+
---
## Hollow Style
Add color classes to give labels additional meaning.
```html_example
-<span class="label">Primary Label</span>
+<span class="label primary">Primary Label</span>
<span class="label secondary">Secondary Label</span>
<span class="label success">Success Label</span>
<span class="label alert">Alert Label</span>
<span class="label warning">Warning Label</span>
```
-<br>
+---
+
+### Custom Colors
+
+If you're using the Sass version of Foundation, you can customize the label classes by editing the `$label-palette` map in your settings file. The label palette defaults to `$foundation-palette`.
+
+If you don't need certain colors from the default palette, simply remove them from the list.
+
+```scss
+$label-palette: map-remove($foundation-palette, (
+ primary,
+ secondary
+)) !default;
+```
+
+Or you can add more colors to the default palette.
+
+```scss
+$label-palette: map-merge($foundation-palette, (
+ purple: #bb00ff
+)) !default;
+```
+
+Or you can define your own custom label palette.
+
+```scss
+$label-palette: (
+ black: #000000,
+ red: #ff0000,
+ purple: #bb00ff
+) !default;
+```
+
+---
-The `$label-classes` list in your settings file determines which colors in `$foundation-palette` will generate color classes. If you don't need a certain badge class, simply remove it from the list.
+### Text Colors
The text color for each label class is determined by either `$label-color` or `$label-color-alt`, whichever settings variable has more contrast.
---
-### With Icons
+## Icons
An icon can be dropped into a label just fine. 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.
/// @type Color
$badge-color-alt: $black !default;
-/// Coloring classes. The names in this list output classes in your CSS, like `.secondary`, `.success`, and so on. Each value must also be in the `$foundation-palette` map.
-/// @type List
-$badge-classes: ( secondary success warning alert ) !default;
+/// Coloring classes. A map of classes to output in your CSS, like `.secondary`, `.success`, and so on.
+/// @type Map
+$badge-palette: $foundation-palette !default;
/// Default padding inside badges.
/// @type Number
background: $badge-background;
color: $badge-color;
- @each $class in $badge-classes {
- $color: get-color($class);
- &.#{$class} {
+ @each $name, $color in $badge-palette {
+ &.#{$name} {
background: $color;
color: color-pick-contrast($color, ($badge-color, $badge-color-alt));
}
large: 1.25rem,
) !default;
-/// Coloring classes. The names in this list output classes in your CSS, like `.secondary`, `.success`, and so on. Each value must also be in the `$foundation-palette` map.
-/// @type List
-$button-classes: ( secondary success warning alert ) !default;
+/// Coloring classes. A map of classes to output in your CSS, like `.secondary`, `.success`, and so on.
+/// @type Map
+$button-palette: $foundation-palette !default;
/// opacity for a disabled button.
/// @type List
&.expanded { @include button-expand; }
// Colors
- @each $class in $button-classes {
- $color: get-color($class);
+ @each $name, $color in $button-palette {
@if $button-fill != hollow {
- &.#{$class} {
+ &.#{$name} {
@include button-style($color, auto, auto);
}
}
@else {
- &.#{$class} {
+ &.#{$name} {
@include button-hollow-style($color);
}
- &.#{$class}.dropdown::after {
+ &.#{$name}.dropdown::after {
border-top-color: $color;
}
}
@include button-hollow;
@include button-hollow-style;
- @each $class in $button-classes {
- $color: get-color($class);
- &.#{$class} {
+ @each $name, $color in $button-palette {
+ &.#{$name} {
@include button-hollow-style($color);
}
}
&[disabled] {
@include button-disabled;
- @each $class in $button-classes {
- $color: get-color($class);
- &.#{$class} {
+ @each $name, $color in $button-palette {
+ &.#{$name} {
@include button-disabled($color);
}
}
/// @type Color
$label-color-alt: $black !default;
-/// Coloring classes. The names in this list output classes in your CSS, like `.secondary`, `.success`, and so on. Each value must also be in the `$foundation-palette` map.
-/// @type List
-$label-classes: ( secondary success warning alert ) !default;
+/// Coloring classes. A map of classes to output in your CSS, like `.secondary`, `.success`, and so on.
+/// @type Map
+$label-palette: $foundation-palette !default;
/// Default font size for labels.
/// @type Number
background: $label-background;
color: $label-color;
- @each $class in $label-classes {
- $color: get-color($class);
- &.#{$class} {
+ @each $name, $color in $label-palette {
+ &.#{$name} {
background: $color;
color: color-pick-contrast($color, ($label-color, $label-color-alt));
}