Skip to content

Instantly share code, notes, and snippets.

@sidHitesh7
Created November 12, 2020 07:12
Show Gist options
  • Select an option

  • Save sidHitesh7/d8177f57b4146e66a0e71c63a87d5f36 to your computer and use it in GitHub Desktop.

Select an option

Save sidHitesh7/d8177f57b4146e66a0e71c63a87d5f36 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
$color: #ff0000;
$colorName: 'red';
@function tetrad($color) {
$hue: hue($color);
$saturation: saturation($color);
$lightness: lightness($color);
$tetrad: [ hsl($hue, $saturation, $lightness),
hsl($hue + 90 % 360, $saturation, $lightness),
hsl($hue + 180 % 360, $saturation, $lightness),
hsl($hue + 270 % 360, $saturation, $lightness), ];
@return $tetrad;
}
@function multiply ($fore, $back) {
$red: red($back) * red($fore) / 255;
$green: green($back) * green($fore) / 255;
$blue: blue($back) * blue($fore) / 255;
@return rgb($red, $green, $blue);
}
@function makeColorPalette($color) {
$light: #fff;
$dark: multiply($color, $color);
$tetrad: tetrad($color);
$palette: (
50: mix($light, $color, 88%),
100: mix($light, $color, 70%),
200: mix($light, $color, 50%),
300: mix($light, $color, 30%),
400: mix($light, $color, 15%),
500: mix($light, $color, 0%),
600: mix($dark, $color, 13%),
700: mix($dark, $color, 30%),
800: mix($dark, $color, 46%),
900: mix($dark, $color, 75%),
A100: lighten(saturate(mix($dark, $color, 15%), 80%), 45.6%),
A200: lighten(saturate(mix($dark, $color, 15%), 80%), 35.6%),
A400: lighten(saturate(mix($dark, $color, 15%), 100%), 25.6%),
A700: lighten(saturate(mix($dark, $color, 15%), 100%), 20.5%)
);
@return $palette;
}
@each $shade, $color in makeColorPalette($color) {
.#{$colorName}-#{$shade} {
background-color: $color;
}
}
.red-50 {
background-color: #ffe0e0;
}
.red-100 {
background-color: #ffb3b3;
}
.red-200 {
background-color: #ff8080;
}
.red-300 {
background-color: #ff4d4d;
}
.red-400 {
background-color: #ff2626;
}
.red-500 {
background-color: red;
}
.red-600 {
background-color: red;
}
.red-700 {
background-color: red;
}
.red-800 {
background-color: red;
}
.red-900 {
background-color: red;
}
.red-A100 {
background-color: #ffe9e9;
}
.red-A200 {
background-color: #ffb6b6;
}
.red-A400 {
background-color: #ff8383;
}
.red-A700 {
background-color: #ff6969;
}
{
"sass": {
"compiler": "dart-sass/1.26.11",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment