Skip to content

Commit ae06020

Browse files
authored
fix: update to button colors (#48)
* refactor: fill in all variables bootstrap offers * fix: update to button colors and states
1 parent 6d8d153 commit ae06020

File tree

12 files changed

+1746
-92
lines changed

12 files changed

+1746
-92
lines changed

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scss/core/extensions/_buttons.scss

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@
33
// and adds a focus outline to all buttons on :focus
44
//
55

6-
@mixin button-inverse-variant($color, $color-hover: color-yiq($color), $active-background: $color, $active-border: $color) {
6+
@mixin button-inverse-variant($color, $background: color-yiq($color), $active-background: $color, $active-border: $color) {
77
color: $color;
88
border-color: transparent;
9-
background-color: #fff;
9+
background-color: $background;
1010

1111
@include hover {
1212
color: darken($color, 7.5%);
13-
background-color: #eee;
13+
background-color: darken($background, 7.5%);
1414
border-color: transparent;
1515
}
1616

17+
&:focus,
18+
&.focus {
19+
border-color: rgba($color, 0.5);
20+
}
21+
1722
&.disabled,
1823
&:disabled {
1924
color: $color;
@@ -36,39 +41,3 @@
3641
@include button-inverse-variant($value);
3742
}
3843
}
39-
40-
41-
// Add focus outlines to all of them. Box shadow focus is turned off in variables.
42-
43-
@each $color, $value in $theme-colors {
44-
.btn-#{$color} {
45-
&.focus,
46-
&:focus {
47-
box-shadow: none;
48-
outline: 1px dotted;
49-
outline: 5px auto -webkit-focus-ring-color;
50-
}
51-
}
52-
}
53-
54-
@each $color, $value in $theme-colors {
55-
.btn-outline-#{$color} {
56-
&.focus,
57-
&:focus {
58-
box-shadow: none;
59-
outline: 1px dotted;
60-
outline: 5px auto -webkit-focus-ring-color;
61-
}
62-
}
63-
}
64-
65-
@each $color, $value in $theme-colors {
66-
.btn-inverse-#{$color} {
67-
&.focus,
68-
&:focus {
69-
box-shadow: none;
70-
outline: 1px dotted;
71-
outline: 5px auto -webkit-focus-ring-color;
72-
}
73-
}
74-
}

scss/edx/_functions.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@function blend-transparent($foreground, $background, $fg-opacity, $bg-opacity: 1) {
2+
// https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
3+
// Adapted from: https://gist.github.com/jdudek/54c80e27510b9b13d4447f803869118f
4+
5+
$opacity: $fg-opacity + $bg-opacity * (1 - $fg-opacity);
6+
$factor: $bg-opacity * (1 - $fg-opacity);
7+
8+
$red: (red($foreground) * $fg-opacity + red($background) * $factor) / $opacity;
9+
$green: (green($foreground) * $fg-opacity + green($background) * $factor) / $opacity;
10+
$blue: (blue($foreground) * $fg-opacity + blue($background) * $factor) / $opacity;
11+
12+
@return rgba($red, $green, $blue, $opacity);
13+
}

0 commit comments

Comments
 (0)