Skip to content

Instantly share code, notes, and snippets.

@ginirsss
Created February 18, 2014 19:45
Show Gist options
  • Save ginirsss/9078476 to your computer and use it in GitHub Desktop.
Save ginirsss/9078476 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<p class="message-info">You might want to know this.</p>
<p class="message-error">There might be something wrong.</p>
<p class="message-alert">You should pay attention!</p>
<p class="message-valid">Everything is okay, move on.</p>
// ----
// Sass (v3.3.0.rc.4)
// Compass (v1.0.0.alpha.18)
// ----
// Configuration variables
// Type name | color scheme
$message-types: (
error : #b94a48,
alert : #c09853,
valid : #468847,
info : #3a87ad
) !default;
// Placeholder for static values
%message {
padding: .5em;
margin: .5em;
border-radius: .15em;
border: 1px solid;
}
// Mixin for dynamic values
// Extending the placeholder
@mixin message($color) {
@extend %message;
color: $color;
background: lighten($color, 38%);
border-color: lighten($color, 20%);
}
// Loop doing all the dumping
@each $type, $color in $message-types {
.message-#{$type} {
@include message($color);
}
}
.message-error, .message-alert, .message-valid, .message-info {
padding: .5em;
margin: .5em;
border-radius: .15em;
border: 1px solid;
}
.message-error {
color: #b94a48;
background: #efd5d4;
border-color: #d59392;
}
.message-alert {
color: #c09853;
background: #f4ede1;
border-color: #dbc59e;
}
.message-valid {
color: #468847;
background: #b6dab7;
border-color: #7aba7b;
}
.message-info {
color: #3a87ad;
background: #bfdcea;
border-color: #7ab5d3;
}
<p class="message-info">You might want to know this.</p>
<p class="message-error">There might be something wrong.</p>
<p class="message-alert">You should pay attention!</p>
<p class="message-valid">Everything is okay, move on.</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment