5a885eccf5416ee826e174a06e64eabbd1e03126
[lhc/web/wiklou.git] / resources / src / mediawiki.rcfilters / styles / mw.rcfilters.mixins.less
1 @import 'mediawiki.mixins';
2 @import 'mw.rcfilters.variables';
3
4 .animation-delay( ... ) {
5 -webkit-animation-delay: @arguments; // Chrome 4-42, Safari 4-8, Opera 15-29, Android 2.1-4.4.4
6 -moz-animation-delay: @arguments; // Firefox 5-15
7 animation-delay: @arguments; // Chrome 43+, Firefox 16+, IE 10+, Edge 12+, Safari 9+, Opera 12.10 & 30+, iOS 9+, Android 47+
8 }
9
10 // This is a general mixin for a color circle
11 .mw-rcfilters-mixin-circle( @color: #fff, @diameter: 2em, @padding: 0.5em, @border: false ) {
12 background-color: @color;
13 .box-sizing( border-box );
14 min-width: @diameter;
15 width: @diameter;
16 min-height: @diameter;
17 height: @diameter;
18 margin: @padding;
19 border-radius: 50%;
20
21 & when ( @border = true ) {
22 border: 1px solid #54595d;
23 }
24 }
25
26 // This is the circle that appears next to the results
27 // Its visibility is directly dependent on whether there is
28 // a color class on its parent element
29 .result-circle( @colorName: 'none' ) {
30 &-@{colorName} {
31 .mw-rcfilters-mixin-circle( ~'@{highlight-@{colorName}}', @result-circle-diameter, 0 );
32 display: none;
33
34 .mw-rcfilters-highlight-color-@{colorName} & {
35 display: inline-block;
36 }
37 }
38 }
39
40 // This mixin produces color mixes for two, three and four colors
41 .highlight-color-mix( @color1, @color2, @color3: false, @color4: false ) {
42 @highlight-color-class-var: ~'.mw-rcfilters-highlight-color-@{color1}.mw-rcfilters-highlight-color-@{color2}';
43
44 // The nature of these variables and them being inside
45 // a 'tint' and 'average' LESS functions is such where
46 // the parsing is failing if it is done inside those functions.
47 // Instead, we first construct their LESS variable names,
48 // and then we call them inside those functions by calling @@var
49 @c1var: ~'highlight-@{color1}';
50 @c2var: ~'highlight-@{color2}';
51
52 // Two colors
53 @{highlight-color-class-var} when ( @color3 = false ) and ( @color4 = false ) and not ( @color1 = false ), ( @color2 = false ) {
54 background-color: tint( average( @@c1var, @@c2var ), 50% );
55 }
56 // Three colors
57 @{highlight-color-class-var}.mw-rcfilters-highlight-color-@{color3} when ( @color4 = false ) and not ( @color3 = false ) {
58 @c3var: ~'highlight-@{color3}';
59 background-color: tint( mix( @@c1var, average( @@c2var, @@c3var ), 33% ), 30% );
60 }
61
62 // Four colors
63 @{highlight-color-class-var}.mw-rcfilters-highlight-color-@{color3}.mw-rcfilters-highlight-color-@{color4} when not ( @color4 = false ) {
64 @c3var: ~'highlight-@{color3}';
65 @c4var: ~'highlight-@{color4}';
66 background-color: tint( mix( @@c1var, mix( @@c2var, average( @@c3var, @@c4var ), 25% ), 25% ), 25% );
67 }
68 }