Last active
July 15, 2024 21:43
-
-
Save SimonPadbury/e0f081400e1c59487a806ea601067ba4 to your computer and use it in GitHub Desktop.
SCSS color palette generator — use to generate a range of color utilities (text color, background, border-color).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example: Set your color variables | |
$color--gray: #888888; | |
$color--blue: #3366FF; | |
$color--teal: #43E7F9; | |
$color--green: #5BD642; | |
$color--orange: #ffae18; | |
$color--red: #FF4732; | |
// Example: Set a color shade step interval | |
$color--interval: 7.6%; | |
// Example: Map your colour names to the variables | |
$colors: () !default; | |
$colors: map-merge(( | |
"gray": $color--gray, | |
"blue": $color--blue, | |
"teal": $color--teal, | |
"green": $color--green, | |
"orange": $color--orange, | |
"red": $color--red | |
), $colors); | |
// Example: Deploy as background (bg) color utility classes | |
@each $key, $value in $colors { | |
.bg--#{$key} { | |
&-100 { | |
background-color: lighten($value, $color--interval * 4); | |
} | |
&-200 { | |
background-color: lighten($value, $color--interval * 3); | |
} | |
&-300 { | |
background-color: lighten($value, $color--interval * 2); | |
} | |
&-400 { | |
background-color: lighten($value, $color--interval); | |
} | |
&-500 { | |
background-color: $value; | |
} | |
&-600 { | |
background-color: darken($value, $color--interval); | |
} | |
&-700 { | |
background-color: darken($value, $color--interval * 2); | |
} | |
&-800 { | |
background-color: darken($value, $color--interval * 3); | |
} | |
&-900 { | |
background-color: darken($value, $color--interval * 4); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add semicolon at the 12 line:
$color--interval: 7.6%;