Skip to content

Commit

Permalink
Bug Fix: Remove junk character in print media
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh-coder committed Oct 24, 2016
1 parent 101cbc3 commit 42fcb17
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 35 deletions.
61 changes: 45 additions & 16 deletions src/pretty.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,35 @@
}
}

@media print {
.pretty:not(.toggle) input:not(:checked) + label i:before,
.pretty > input[type='radio']:checked + label > i.default:before,
.pretty i:after {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
color: transparent !important;
}
.pretty input:checked + label i:before {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
.pretty.primary input:checked + label i:before {
color: white !important;
}
.pretty.success input:checked + label i:before {
color: white !important;
}
.pretty.info input:checked + label i:before {
color: white !important;
}
.pretty.warning input:checked + label i:before {
color: white !important;
}
.pretty.danger input:checked + label i:before {
color: white !important;
}
}

.pretty {
position: relative;
line-height: 1;
Expand Down Expand Up @@ -184,7 +213,7 @@
}

.pretty > input[type='radio']:checked + label > i.default:before {
background: #aaa;
background-color: #aaa !important;
}

.pretty > input[type='checkbox'][disabled],
Expand Down Expand Up @@ -237,17 +266,17 @@
}

.pretty.primary input:checked + label i:after {
background-color: #428bca;
background-color: #428bca !important;
border-color: #428bca;
}

.pretty.primary input[type='radio']:checked + label i.default:before {
background-color: #428bca;
background-color: #428bca !important;
color: transparent;
}

.pretty.primary input[type='radio']:checked + label i.default:after {
background-color: initial;
background-color: initial !important;
border-color: #428bca;
}

Expand Down Expand Up @@ -291,17 +320,17 @@
}

.pretty.success input:checked + label i:after {
background-color: #5cb85c;
background-color: #5cb85c !important;
border-color: #5cb85c;
}

.pretty.success input[type='radio']:checked + label i.default:before {
background-color: #5cb85c;
background-color: #5cb85c !important;
color: transparent;
}

.pretty.success input[type='radio']:checked + label i.default:after {
background-color: initial;
background-color: initial !important;
border-color: #5cb85c;
}

Expand Down Expand Up @@ -345,17 +374,17 @@
}

.pretty.info input:checked + label i:after {
background-color: #5bc0de;
background-color: #5bc0de !important;
border-color: #5bc0de;
}

.pretty.info input[type='radio']:checked + label i.default:before {
background-color: #5bc0de;
background-color: #5bc0de !important;
color: transparent;
}

.pretty.info input[type='radio']:checked + label i.default:after {
background-color: initial;
background-color: initial !important;
border-color: #5bc0de;
}

Expand Down Expand Up @@ -399,17 +428,17 @@
}

.pretty.warning input:checked + label i:after {
background-color: #f0ad4e;
background-color: #f0ad4e !important;
border-color: #f0ad4e;
}

.pretty.warning input[type='radio']:checked + label i.default:before {
background-color: #f0ad4e;
background-color: #f0ad4e !important;
color: transparent;
}

.pretty.warning input[type='radio']:checked + label i.default:after {
background-color: initial;
background-color: initial !important;
border-color: #f0ad4e;
}

Expand Down Expand Up @@ -453,17 +482,17 @@
}

.pretty.danger input:checked + label i:after {
background-color: #d9534f;
background-color: #d9534f !important;
border-color: #d9534f;
}

.pretty.danger input[type='radio']:checked + label i.default:before {
background-color: #d9534f;
background-color: #d9534f !important;
color: transparent;
}

.pretty.danger input[type='radio']:checked + label i.default:after {
background-color: initial;
background-color: initial !important;
border-color: #d9534f;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pretty.min.css

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions src/scss/decorators/_color.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
$outline-colors: (
primary outline-primary #428bca,
success outline-success #5cb85c,
info outline-info #5bc0de,
warning outline-warning #f0ad4e,
danger outline-danger #d9534f
) !default;

@each $color in $outline-colors{
.#{$pretty-class-name}.#{nth($color,1)}{
input:checked+ label i{
&:before{
color:#fff;
}
&:after{
background-color:nth($color,3);
background-color:nth($color,3) !important;
border-color:nth($color,3)
}
}
input[type='radio']:checked+ label i.default{
&:before{
background-color:nth($color,3);
background-color:nth($color,3) !important;
color:transparent;
}
&:after{
background-color: initial;
background-color: initial !important;
border-color:nth($color,3)
}
}
Expand All @@ -36,7 +28,7 @@ $outline-colors: (
.#{$pretty-class-name}.#{nth($color,2)}{
input:checked+label i{
&:before{
color:nth($color,3)
color:nth($color,3);
}
&:after{
border-color:nth($color,3);
Expand Down
2 changes: 1 addition & 1 deletion src/scss/decorators/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
}
&>input[type='radio']:checked+label>i.default{
&:before{
background: #aaa;
background-color: #aaa !important;
}
&:after{}
}
Expand Down
2 changes: 1 addition & 1 deletion src/scss/support/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'variables';
@import 'mixins';
@import 'animations';
@import 'print';
@import 'print';
19 changes: 16 additions & 3 deletions src/scss/support/_print.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
@media print{
.pretty i:after{
@media print {
.#{$pretty-class-name}:not(.toggle) input:not(:checked)+label i:before,
.#{$pretty-class-name} > input[type='radio']:checked + label > i.default:before,
.#{$pretty-class-name} i:after {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
color: transparent !important;
}
}

.#{$pretty-class-name} input:checked + label i:before{
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}

@each $color in $outline-colors {
.#{$pretty-class-name}.#{nth($color, 1)} input:checked + label i:before {
color: white !important;
}
}
}
9 changes: 8 additions & 1 deletion src/scss/support/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
$pretty-class-name:pretty !default;
$pretty-font-family:"Material Design Icons" !default;
$pretty-border-radius:2px !default;
$pretty-border-radius:2px !default;
$outline-colors: (
primary outline-primary #428bca,
success outline-success #5cb85c,
info outline-info #5bc0de,
warning outline-warning #f0ad4e,
danger outline-danger #d9534f
) !default;

0 comments on commit 42fcb17

Please sign in to comment.