| 1 |
@import 'mediawiki.skin.variables.less'; |
| 2 |
@import 'mw.rcfilters.variables.less'; |
| 3 |
@import 'mediawiki.mixins.less'; |
| 4 |
|
| 5 |
/* stylelint-disable selector-class-pattern */ |
| 6 |
|
| 7 |
// Circle mixin |
| 8 |
.mw-rcfilters-circle( @min-size-diameter: @min-size-circle, @size-diameter: @size-circle, @margin: 0.5em ) { |
| 9 |
box-sizing: border-box; |
| 10 |
min-width: @min-size-diameter; |
| 11 |
width: @size-diameter; |
| 12 |
min-height: @min-size-diameter; |
| 13 |
height: @size-diameter; |
| 14 |
margin: @margin; |
| 15 |
border-radius: @border-radius-circle; |
| 16 |
} |
| 17 |
|
| 18 |
// Circle color mixin |
| 19 |
.mw-rcfilters-circle-color( @param-background-color: @background-color-base, @param-border: false, @param-border-color: #54595d, @param-empty-background: false ) { |
| 20 |
& when ( @param-empty-background = false ) { |
| 21 |
background-color: @param-background-color; |
| 22 |
} |
| 23 |
|
| 24 |
& when ( @param-empty-background = true ) { |
| 25 |
background-color: @highlight-none; |
| 26 |
} |
| 27 |
|
| 28 |
& when ( @param-border = true ) { |
| 29 |
border: @border-width-base @border-style-base @param-border-color; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
// This is the circle that appears next to the results |
| 34 |
// Its visibility is directly dependent on whether there is |
| 35 |
// a color class on its parent element |
| 36 |
.result-circle( @colorName: 'none' ) { |
| 37 |
&-@{colorName} { |
| 38 |
display: none; |
| 39 |
.mw-rcfilters-circle-color( ~'@{highlight-@{colorName}}' ); |
| 40 |
|
| 41 |
.mw-rcfilters-highlight-color-@{colorName} & { |
| 42 |
display: inline-block; |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
// A mixin for changes list containers. Applies enough margin-left to fit the 5 highlight circles. |
| 48 |
.result-circle-margin() { |
| 49 |
margin-left: ~'calc( ( @{size-circle-result} + @{margin-circle-result} ) * 5 + @{margin-circle} )'; |
| 50 |
} |
| 51 |
|
| 52 |
.background-color-with-dark-mode( @bgcolor ) { |
| 53 |
background-color: @bgcolor; |
| 54 |
|
| 55 |
html.skin-theme-clientpref-night & { |
| 56 |
background-color: darken( @bgcolor, 70% ); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Auto night mode. |
| 61 |
* |
| 62 |
* Applies the night mode color palette only in response to system settings. |
| 63 |
*/ |
| 64 |
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */ |
| 65 |
@media ( prefers-color-scheme: dark ) { |
| 66 |
html.skin-theme-clientpref-os & { |
| 67 |
background-color: darken( @bgcolor, 70% ); |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
// A mixin just for changesListWrapperWidget page, to output the scope of the widget |
| 73 |
// so it is before the rest of the rule; we need the li& to be in |
| 74 |
// between the wrapper scope and the color-cX class, which doesn't |
| 75 |
// work if the rules are inside the above widget LESS scope |
| 76 |
.highlight-results( @bgcolor ) { |
| 77 |
.mw-rcfilters-ui-changesListWrapperWidget li&, |
| 78 |
.mw-rcfilters-ui-changesListWrapperWidget & tr:first-child, |
| 79 |
.mw-rcfilters-ui-changesListWrapperWidget tr&.mw-rcfilters-ui-highlights-enhanced-toplevel:not( .mw-rcfilters-ui-changesListWrapperWidget-enhanced-grey ) td:not( :nth-child( -n+2 ) ), |
| 80 |
.mw-rcfilters-ui-changesListWrapperWidget tr&.mw-rcfilters-ui-highlights-enhanced-nested:not( .mw-rcfilters-ui-changesListWrapperWidget-enhanced-grey ) td:not( :nth-child( -n+4 ) ) { |
| 81 |
.background-color-with-dark-mode( @bgcolor ); |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
// This mixin produces color mixes for two, three and four colors |
| 86 |
.highlight-color-mix( @color1, @color2, @color3: false, @color4: false ) { |
| 87 |
@highlight-color-class-var: ~'.mw-rcfilters-highlight-color-@{color1}.mw-rcfilters-highlight-color-@{color2}'; |
| 88 |
|
| 89 |
// The nature of these variables and them being inside |
| 90 |
// a 'tint' and 'average' LESS functions is such where |
| 91 |
// the parsing is failing if it is done inside those functions. |
| 92 |
// Instead, we first construct their LESS variable names, |
| 93 |
// and then we call them inside those functions by calling @@var |
| 94 |
@c1var: ~'highlight-@{color1}'; |
| 95 |
@c2var: ~'highlight-@{color2}'; |
| 96 |
|
| 97 |
// Two colors |
| 98 |
@{highlight-color-class-var} when ( @color3 = false ) and ( @color4 = false ) and not ( @color1 = false ), ( @color2 = false ) { |
| 99 |
.highlight-results( tint( average( @@c1var, @@c2var ), 50% ) ); |
| 100 |
} |
| 101 |
// Three colors |
| 102 |
@{highlight-color-class-var}.mw-rcfilters-highlight-color-@{color3} when ( @color4 = false ) and not ( @color3 = false ) { |
| 103 |
@c3var: ~'highlight-@{color3}'; |
| 104 |
.highlight-results( tint( mix( @@c1var, average( @@c2var, @@c3var ), 33% ), 30% ) ); |
| 105 |
} |
| 106 |
|
| 107 |
// Four colors |
| 108 |
@{highlight-color-class-var}.mw-rcfilters-highlight-color-@{color3}.mw-rcfilters-highlight-color-@{color4} when not ( @color4 = false ) { |
| 109 |
@c3var: ~'highlight-@{color3}'; |
| 110 |
@c4var: ~'highlight-@{color4}'; |
| 111 |
.highlight-results( tint( mix( @@c1var, mix( @@c2var, average( @@c3var, @@c4var ), 25% ), 25% ), 25% ) ); |
| 112 |
} |
| 113 |
} |