Skip to content

Commit

Permalink
feat(colors): improve .text-body & .text-muted utilities to ensure pr…
Browse files Browse the repository at this point in the history
…oper contrasts, to close #274
  • Loading branch information
ffoodd committed Jan 8, 2020
1 parent 33b94e7 commit 0d62c74
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ $small-font-size: $font-size-sm !default; // Boosted mod → 14px
$small-line-height: $line-height-sm !default; // Boosted mod → 16px

$text-muted: $gray-700 !default;
$text-muted-dark: $gray-600 !default; // Boosted mod: ensure contrast on dark background

$blockquote-small-color: $gray-700 !default;
$blockquote-small-font-size: $small-font-size !default;
Expand Down
2 changes: 1 addition & 1 deletion scss/mixins/_background-variant.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@mixin bg-variant($parent, $color, $ignore-warning: false) {
$contrast: color-yiq($color); // Boosted mod: ensure contrast
#{$parent} {
color: $contrast; // Boosted mod: ensure contrast
color: $contrast !important; // Boosted mod: ensure contrast
background-color: $color !important;
}
a#{$parent},
Expand Down
27 changes: 23 additions & 4 deletions scss/utilities/_text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@

// Contextual colors

// Boosted mod: ensure contrast
.text-white {
color: $white !important;
background-color: $black !important;
}
// end mod

@each $color, $value in $theme-colors {
// Boosted mod: disallow functionnal colors for text
Expand All @@ -58,17 +60,34 @@
// end mod
}

// Boosted mod
// Boosted mod: ensure contrast
.text-body {
color: $body-color !important;
background-color: $body-bg !important;
}

.text-muted {
color: $text-muted !important;
background-color: $white !important;
}

.bg-dark,
.table-dark,
.navbar-dark {
@include text-emphasis-variant(".text-primary", $orange-2, true);

.text-body {
color: $body-bg !important;
background-color: $body-color !important;
}

.text-muted {
color: $text-muted-dark !important;
background-color: $black !important;
}
}
// end mod

.text-body { color: $body-color !important; }
.text-muted { color: $text-muted !important; }

//.text-black-50 { color: rgba($black, .5) !important; } // Boosted mod
//.text-white-50 { color: rgba($white, .5) !important; } // Boosted mod

Expand Down

0 comments on commit 0d62c74

Please sign in to comment.