Skip to content

Instantly share code, notes, and snippets.

@yangjunjun
Created March 24, 2014 01:54
Show Gist options
  • Save yangjunjun/9732879 to your computer and use it in GitHub Desktop.
Save yangjunjun/9732879 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.4)
// Compass (v1.0.0.alpha.18)
// ----
%message {
padding: .5em;
margin-bottom: .5em;
border-radius: .15em;
border: 1px solid;
}
@mixin message($color) {
@extend %message;
color: $color;
border-color: lighten($color, 20%);
background: lighten($color, 40%);
}
/* First method */
.message-error {
@include message(#b94a48);
}
.message-valid {
@include message(#468847);
}
.message-warning {
@include message(#c09853);
}
.message-info {
@include message(#3a87ad);
}
/* Second method */
$message-types: (
(error #b94a48)
(valid #468847)
(warning #c09853)
(info #3a87ad)
) !default;
@each $message-type in $message-types {
$type: nth($message-type, 1);
$color: nth($message-type, 2);
.message-#{$type} {
@include message($color);
}
}
/* Third method */
@each $type, $color in $message-types {
.message-#{$type} {
@include message($color);
}
}
.message-error, .message-valid, .message-warning, .message-info {
padding: .5em;
margin-bottom: .5em;
border-radius: .15em;
border: 1px solid;
}
/* First method */
.message-error {
color: #b94a48;
border-color: #d59392;
background: #f1dcdc;
}
.message-valid {
color: #468847;
border-color: #7aba7b;
background: #bdddbd;
}
.message-warning {
color: #c09853;
border-color: #dbc59e;
background: #f7f1e8;
}
.message-info {
color: #3a87ad;
border-color: #7ab5d3;
background: #c7e0ec;
}
/* Second method */
.message-error {
color: #b94a48;
border-color: #d59392;
background: #f1dcdc;
}
.message-valid {
color: #468847;
border-color: #7aba7b;
background: #bdddbd;
}
.message-warning {
color: #c09853;
border-color: #dbc59e;
background: #f7f1e8;
}
.message-info {
color: #3a87ad;
border-color: #7ab5d3;
background: #c7e0ec;
}
/* Third method */
.message-error {
color: #b94a48;
border-color: #d59392;
background: #f1dcdc;
}
.message-valid {
color: #468847;
border-color: #7aba7b;
background: #bdddbd;
}
.message-warning {
color: #c09853;
border-color: #dbc59e;
background: #f7f1e8;
}
.message-info {
color: #3a87ad;
border-color: #7ab5d3;
background: #c7e0ec;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment