Skip to content

Commit

Permalink
fix: update to button colors (#48)
Browse files Browse the repository at this point in the history
* refactor: fill in all variables bootstrap offers

* fix: update to button colors and states
  • Loading branch information
abutterworth authored Apr 17, 2019
1 parent 6d8d153 commit ae06020
Show file tree
Hide file tree
Showing 12 changed files with 1,746 additions and 92 deletions.
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 8 additions & 39 deletions scss/core/extensions/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
// and adds a focus outline to all buttons on :focus
//

@mixin button-inverse-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) {
@mixin button-inverse-variant($color, $background: color-yiq($color), $active-background: $color, $active-border: $color) {
color: $color;
border-color: transparent;
background-color: #fff;
background-color: $background;

@include hover {
color: darken($color, 7.5%);
background-color: #eee;
background-color: darken($background, 7.5%);
border-color: transparent;
}

&:focus,
&.focus {
border-color: rgba($color, 0.5);
}

&.disabled,
&:disabled {
color: $color;
Expand All @@ -36,39 +41,3 @@
@include button-inverse-variant($value);
}
}


// Add focus outlines to all of them. Box shadow focus is turned off in variables.

@each $color, $value in $theme-colors {
.btn-#{$color} {
&.focus,
&:focus {
box-shadow: none;
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
}
}

@each $color, $value in $theme-colors {
.btn-outline-#{$color} {
&.focus,
&:focus {
box-shadow: none;
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
}
}

@each $color, $value in $theme-colors {
.btn-inverse-#{$color} {
&.focus,
&:focus {
box-shadow: none;
outline: 1px dotted;
outline: 5px auto -webkit-focus-ring-color;
}
}
}
13 changes: 13 additions & 0 deletions scss/edx/_functions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@function blend-transparent($foreground, $background, $fg-opacity, $bg-opacity: 1) {
// https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
// Adapted from: https://gist.github.com/jdudek/54c80e27510b9b13d4447f803869118f

$opacity: $fg-opacity + $bg-opacity * (1 - $fg-opacity);
$factor: $bg-opacity * (1 - $fg-opacity);

$red: (red($foreground) * $fg-opacity + red($background) * $factor) / $opacity;
$green: (green($foreground) * $fg-opacity + green($background) * $factor) / $opacity;
$blue: (blue($foreground) * $fg-opacity + blue($background) * $factor) / $opacity;

@return rgba($red, $green, $blue, $opacity);
}
Loading

0 comments on commit ae06020

Please sign in to comment.