forked from EliseWei/scss-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
completed.scss
127 lines (114 loc) · 2.45 KB
/
completed.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
$browserPrefixes: '-webkit-' '-moz-' '-o-' '';
body, * {
margin: 0;
padding: 0;
font-size: 100%; }
body {
font-size: 12px; }
$baseColor: #8C184E;
.colors {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-gap: 10px;
padding: 10px;
box-sizing: border-box;
}
.color-block {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
padding: 20px;
font-size: 200%;
line-height: 1;
transition: all .3s ease;
}
@mixin setColors($blockColor) {
background-color: $blockColor;
color: getTextColor($blockColor);
}
@function getTextColor($background) {
@if (lightness($background) > 50) {
@return darken($background, 60%); // Lighter backgorund, return dark color
} @else {
@return lighten($background, 60%); // Darker background, return light color
}
}
.base {
@include setColors($baseColor);
}
.dark {
$blockColor: darken($baseColor, 20%);
@include setColors($blockColor);
}
.dull {
$blockColor: desaturate($baseColor, 30%);
@include setColors($blockColor);
}
.light {
$blockColor: lighten($baseColor, 30%);
@include setColors($blockColor);
}
.bright {
$blockColor: saturate($baseColor, 30%);
@include setColors($blockColor);
}
.contrast {
$blockColor: adjust-hue($baseColor, 180deg);
@include setColors($blockColor);
}
@mixin animate($settings...) {
@each $browser in $browserPrefixes {
@each $prop in $settings {
#{$browser}animation-#{nth($prop, 1)}: nth($prop, 2);
}
}
}
@mixin keyframes($animationName) {
@-webkit-keyframes #{$animationName} {
@content;
}
@-moz-keyframes #{$animationName} {
@content;
}
@-o-keyframes #{$animationName} {
@content;
}
@keyframes #{$animationName} {
@content;
}
}
$bannerAnimation: flyout;
/* Initial styles for the banner */
#banner {
width: 300px;
height: 100px;
background: aqua;
position:fixed;
bottom:-110px;
z-index:9999;
right:80px;
@include animate(
'name' $bannerAnimation,
'duration' 5s,
'timing-function' linear,
'delay' 1s,
'iteration-count' 1,
'direction' normal,
'play-state' running,
'fill-mode' forwards);
}
@include keyframes($bannerAnimation) {
0% {
bottom: -110px;
}
40% {
bottom: 0px;
}
60% {
bottom: 0px;
}
100% {
bottom: -110px;
}
}