0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-02-23 20:54:22 +01:00
Bootstrap/scss/mixins/_buttons.scss
Mark Otto 7915584fa4 lol
2024-07-29 22:04:11 -07:00

76 lines
3.8 KiB
SCSS

@use "sass:color";
@use "../functions";
@use "../variables";
@use "../vendor/rfs";
// Button variants
//
// Easily pump out default styles, as well as :hover, :focus, :active,
// and disabled options for all buttons
// scss-docs-start btn-variant-mixin
@mixin button-variant(
$background,
$border,
$color: functions.color-contrast($background),
$hover-background: if($color == variables.$color-contrast-light, functions.shade-color($background, variables.$btn-hover-bg-shade-amount), functions.tint-color($background, variables.$btn-hover-bg-tint-amount)),
$hover-border: if($color == variables.$color-contrast-light, functions.shade-color($border, variables.$btn-hover-border-shade-amount), functions.tint-color($border, variables.$btn-hover-border-tint-amount)),
$hover-color: functions.color-contrast($hover-background),
$active-background: if($color == variables.$color-contrast-light, functions.shade-color($background, variables.$btn-active-bg-shade-amount), functions.tint-color($background, variables.$btn-active-bg-tint-amount)),
$active-border: if($color == variables.$color-contrast-light, functions.shade-color($border, variables.$btn-active-border-shade-amount), functions.tint-color($border, variables.$btn-active-border-tint-amount)),
$active-color: functions.color-contrast($active-background),
$disabled-background: $background,
$disabled-border: $border,
$disabled-color: functions.color-contrast($disabled-background)
) {
--#{variables.$prefix}btn-color: #{$color};
--#{variables.$prefix}btn-bg: #{$background};
--#{variables.$prefix}btn-border-color: #{$border};
--#{variables.$prefix}btn-hover-color: #{$hover-color};
--#{variables.$prefix}btn-hover-bg: #{$hover-background};
--#{variables.$prefix}btn-hover-border-color: #{$hover-border};
--#{variables.$prefix}btn-focus-shadow-rgb: #{functions.to-rgb(color.mix($color, $border, 15%))};
--#{variables.$prefix}btn-active-color: #{$active-color};
--#{variables.$prefix}btn-active-bg: #{$active-background};
--#{variables.$prefix}btn-active-border-color: #{$active-border};
--#{variables.$prefix}btn-active-shadow: #{variables.$btn-active-box-shadow};
--#{variables.$prefix}btn-disabled-color: #{$disabled-color};
--#{variables.$prefix}btn-disabled-bg: #{$disabled-background};
--#{variables.$prefix}btn-disabled-border-color: #{$disabled-border};
}
// scss-docs-end btn-variant-mixin
// scss-docs-start btn-outline-variant-mixin
@mixin button-outline-variant(
$color,
$color-hover: functions.color-contrast($color),
$active-background: $color,
$active-border: $color,
$active-color: functions.color-contrast($active-background)
) {
--#{variables.$prefix}btn-color: #{$color};
--#{variables.$prefix}btn-border-color: #{$color};
--#{variables.$prefix}btn-hover-color: #{$color-hover};
--#{variables.$prefix}btn-hover-bg: #{$active-background};
--#{variables.$prefix}btn-hover-border-color: #{$active-border};
--#{variables.$prefix}btn-focus-shadow-rgb: #{functions.to-rgb($color)};
--#{variables.$prefix}btn-active-color: #{$active-color};
--#{variables.$prefix}btn-active-bg: #{$active-background};
--#{variables.$prefix}btn-active-border-color: #{$active-border};
--#{variables.$prefix}btn-active-shadow: #{variables.$btn-active-box-shadow};
--#{variables.$prefix}btn-disabled-color: #{$color};
--#{variables.$prefix}btn-disabled-bg: transparent;
--#{variables.$prefix}btn-disabled-border-color: #{$color};
--#{variables.$prefix}gradient: none;
}
// scss-docs-end btn-outline-variant-mixin
// scss-docs-start btn-size-mixin
@mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
--#{variables.$prefix}btn-padding-y: #{$padding-y};
--#{variables.$prefix}btn-padding-x: #{$padding-x};
@include rfs.rfs($font-size, --#{variables.$prefix}btn-font-size);
--#{variables.$prefix}btn-border-radius: #{$border-radius};
}
// scss-docs-end btn-size-mixin