Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaël Poupard <gael.poupard@orange.com>2020-04-07 16:59:51 +0300
committerGaël Poupard <ffoodd@users.noreply.github.com>2020-05-20 10:49:18 +0300
commita0dd474bc6486ec573e7319aa9e95862f8ca923b (patch)
tree6d4a509103d1cf277eb7cedf02c37be1b478e888 /site/assets/scss/_colors.scss
parenta7e1b914ef43fee0d309b9463f7f5bc5442845ba (diff)
docs(theming): display contrast ratios in color swatches
Diffstat (limited to 'site/assets/scss/_colors.scss')
-rw-r--r--site/assets/scss/_colors.scss31
1 files changed, 31 insertions, 0 deletions
diff --git a/site/assets/scss/_colors.scss b/site/assets/scss/_colors.scss
index 911c44c736..17c6783658 100644
--- a/site/assets/scss/_colors.scss
+++ b/site/assets/scss/_colors.scss
@@ -6,6 +6,37 @@
.swatch-#{$color} {
color: color-contrast($value);
background-color: #{$value};
+
+ &::after {
+ $contrast-ratio: "#{contrast-ratio($value, color-contrast($value))}";
+ $against-white: "#{contrast-ratio($value, $white)}";
+ $against-black: "#{contrast-ratio($value, $black)}";
+ position: absolute;
+ top: 1rem;
+ right: 1rem;
+ padding-left: 1rem;
+ font-size: .75rem;
+ line-height: 1.35;
+ white-space: pre;
+ content:
+ str-slice($contrast-ratio, 1, 4) "\A"
+ str-slice($against-white, 1, 4) "\A"
+ str-slice($against-black, 1, 4);
+ background-color: $value;
+ background-image:
+ linear-gradient(
+ to bottom,
+ transparent .25rem,
+ color-contrast($value) .25rem .75rem,
+ transparent .75rem 1.25rem,
+ $white 1.25rem 1.75rem,
+ transparent 1.75rem 2.25rem,
+ $black 2.25rem 2.75rem,
+ transparent 2.75rem
+ );
+ background-repeat: no-repeat;
+ background-size: .5rem 100%;
+ }
}
}