Skip to content

Commit 11042b3

Browse files
authored
[Hot Cards] Add Holo style preset and fix display on mobile (stashapp#371)
1 parent 495c14a commit 11042b3

File tree

6 files changed

+317
-47
lines changed

6 files changed

+317
-47
lines changed

plugins/hotCards/README.md

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,54 +29,52 @@ _[criterion]\_[value]\_[style]\_[gradient-opts]\_[hover-opts]\_[card-opts]_
2929
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3030
| `<criterion>` | Defines the basis for applying styles. Use `t` for tag-based criteria, `r` for rating-based criteria, or `d` to disable. | If left empty, it will default to the global _Tag ID_ or _Rating Threshold_ as configured. If both options are enabled and unspecified, ~~the Tag ID will be used by default~~ both criteria will be used. |
3131
| `<value>` | Specifies the exact value for the Tag ID or Rating Threshold to be used.<br><br>_Multiple values can be specified using a comma-separated list and slashes to delimit each set of criteria:_ `<tag_id>,.../<tag_id>,.../...` or `<rating>/<rating>/...` | Defaults to the global _Tag ID_ or _Rating Threshold_ value.<br><br>**Important**: When dealing with tenths precision (e.g. 4.8, 3.25), map these to the 6-100 range and set the _Rating Threshold_ in that range. Thus, 4.8 would be 96, 3.25 would be 65, and so on.<br><br>See [this additional information](#regarding-multiple-values) on multiple values. |
32-
| `<style>` | Defines the styling options as a comma-separated list of colors or a style preset.</br></br>Options include: a fixed color (e.g., #5ff2a2), a style preset (e.g., hot), or a gradient (e.g., #ef1313,#3bd612,... hex color codes or color names).<br><br>_A style can be specified for each set of values using a slash-separated list:_ `<style>/<style>/...` | Defaults to **default** (basic style preset)<br><br>Style Presets available: **default**, **hot**, **gold**. |
32+
| `<style>` | Defines the styling options as a comma-separated list of colors or a style preset.</br></br>Options include: a fixed color (e.g., #5ff2a2), a style preset (e.g., hot), or a gradient (e.g., #ef1313,#3bd612,... hex color codes or color names).<br><br>_A style can be specified for each set of values using a slash-separated list:_ `<style>/<style>/...` | Defaults to **default** (basic style preset)<br><br>Style Presets available: [**default**](#default), [**hot**](#hot), [**gold**](#gold), and [**holo**](#holo). |
3333
| `<gradient_opts>` | Specifies gradient options as a comma-separated list: `<type>,<angle>,<animation>`.</br></br> Example: **linear,35deg,4s alternate infinite** for a linear gradient with a 35-degree angle and a 4-second alternating infinite animation.</br></br>_Gradient options can be specified for each set of values using a slash-separated list:_ `<gradient_opts>/<gradient_opts>/...` | `<type>` Defaults to **linear**</br></br>Refer to [Using CSS gradients](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_images/Using_CSS_gradients) to see all types you can use.</br></br>`<angle>` Defaults to **0deg**</br></br>`<animation>` Defaults to **none**</br></br>Note that you can only configure the animation properties of the element. See [Using CSS animations](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations/Using_CSS_animations) for additional information. |
3434
| `<hover_opts>` | Specifies hover options as a comma-separated list: `<color>,<animation>`.</br></br>Example: **#ff0000,2s ease infinite** for a hover effect with a color of #ff0000 and a 2-second ease infinite animation.</br></br>_Hover options can be specified for each set of values using a slash-separated list:_ `<hover_opts>/<hover_opts>/...` | `<color>` Defaults to **transparent**</br></br>`<animation>` Defaults to **none**</br></br>Similar to the gradient animation, you can only configure the animation properties of the element. |
35-
| `<card_opts>` | Specifies the general options for the card as a comma-separated list: `<fill>,<opacity>`.</br></br>_Card options can be specified for each set of values using a slash-separated list:_ `<card_opts>/<card_opts>/...` | `fill` Defaults to **true**<br>_Indicates whether the card should be filled._</br></br>Tip: You can set this to **false** to color only the border of the card.</br></br>`opacity` Defaults to **80**<br>_Represents the opacity for the card background. Range from 0 to 100._ |
36-
37-
<br>
35+
| `<card_opts>` | Specifies the general options for the card as a comma-separated list: `<fill>,<opacity>,<animation>`.</br></br>_Card options can be specified for each set of values using a slash-separated list:_ `<card_opts>/<card_opts>/...` | `fill` Defaults to **true**<br>_Indicates whether the card should be filled._</br></br>Tip: You can set this to **false** to color only the border of the card.</br></br>`opacity` Defaults to **80**<br>_Represents the opacity for the card background. Range from 0 to 100._</br></br>`animation` Defaults to **false**<br>_Only used for [**holo**](#holo) style preset._ |
3836

3937
**Note**: _It is recommended to refresh the page once you are done configuring for the changes to take effect and the previous style to be overwritten._
4038

4139
### Regarding multiple values
4240

4341
In scenarios where multiple values are specified, the rules for how these values are processed can get complex. Below is a detailed explanation of how to handle multiple values.
4442

45-
#### 1. **Tag IDs**
43+
1. **Tag IDs**
4644

47-
Corresponding styles _(style, gradient_opts, hover_opts, card_opts)_ are applied only if **ALL** tags in a set match.
45+
Corresponding styles _(style, gradient_opts, hover_opts, card_opts)_ are applied only if **ALL** tags in a set match.
4846

49-
The tags are prioritized from **left to right**, meaning if it finds a match for a tag list, the corresponding style is applied and subsequent sets that may also match are ignored.
47+
The tags are prioritized from **left to right**, meaning if it finds a match for a tag list, the corresponding style is applied and subsequent sets that may also match are ignored.
5048

51-
For example:
49+
For example:
5250

53-
`t_201,202/202_red/blue`
51+
`t_201,202/202_red/blue`
5452

55-
- A card with tags 201 and 202 will be painted red.
56-
- A card with tag 202 will be painted blue (only if it does not have tag 201).
53+
- A card with tags 201 and 202 will be painted red.
54+
- A card with tag 202 will be painted blue (only if it does not have tag 201).
5755

58-
Conversely, `t_202/201,202_blue/red`
56+
Conversely, `t_202/201,202_blue/red`
5957

60-
- A card with tag 202 will be painted blue, regardless of the presence of tag 201. Therefore, there will be no cards painted red.
58+
- A card with tag 202 will be painted blue, regardless of the presence of tag 201. Therefore, there will be no cards painted red.
6159

62-
#### 2. **Ratings**
60+
2. **Ratings**
6361

64-
The same left-to-right prioritization applies.
62+
The same left-to-right prioritization applies.
6563

66-
Consider the declaration:
64+
Consider the declaration:
6765

68-
`r_4/2_red/blue`
66+
`r_4/2_red/blue`
6967

70-
- A card with a rating >= 4 will be painted red.
71-
- A card with a rating >= 2 but < 4 will be painted blue.
68+
- A card with a rating >= 4 will be painted red.
69+
- A card with a rating >= 2 but < 4 will be painted blue.
7270

73-
<br>
71+
<br>
7472

75-
You can also specify multiple ratings in a single value if you wish to target multiple specific ratings, though such scenarios are rare and generally not as useful. For instance:
73+
You can also specify multiple ratings in a single value if you wish to target multiple specific ratings, though such scenarios are rare and generally not as useful. For instance:
7674

77-
`r_2,4_blue`
75+
`r_2,4_blue`
7876

79-
- Targets cards with exact ratings of 4 or 2. Here, the order does not matter.
77+
- Targets cards with exact ratings of 4 or 2. Here, the order does not matter.
8078

8179
## Examples
8280

@@ -166,7 +164,7 @@ You can also specify multiple ratings in a single value if you wish to target mu
166164
| criterion | t | Tag-based |
167165
| value | 111,116,78,87 | Use tags 111, 116, 78, 87 |
168166
| style | blue | Set fixed color |
169-
| gradient-opts | | No animation |
167+
| gradient-opts | | No gradient |
170168
| hover-opts | green | Set hover effect color |
171169
| card-opts | | Use default values |
172170

@@ -182,7 +180,7 @@ You can also specify multiple ratings in a single value if you wish to target mu
182180
| value | 111,116,78,87/105 | Use tags 111, 116, 78, 87 or 105 |
183181
| style | pink,red,white/orange,white | Apply pink, red, white gradient for first set of tags; orange, white for tag 105 |
184182
| gradient-opts | /,70deg,4s alternate infinite | No animation for first set of tags; 70deg, 4s alternate infinite for tag 105 |
185-
| hover-opts | | Use default hover options |
183+
| hover-opts | | No hover effect |
186184
| card-opts | ,30/ | Set opacity to 30 for first set of tags; default opacity for tag 105 |
187185

188186
---
@@ -196,8 +194,8 @@ You can also specify multiple ratings in a single value if you wish to target mu
196194
| criterion | r | Rating-based |
197195
| value | 5/4/3 | Use ratings 5, 4, and 3 |
198196
| style | gold/hot/default | Apply gold style to ratings 5, hot style to ratings 4, and default style to ratings 3 |
199-
| gradient-opts | | Use default gradient options |
200-
| hover-opts | | Use default hover options |
197+
| gradient-opts | | Use corresponding gradient options |
198+
| hover-opts | | Use corresponding hover options |
201199
| card-opts | //,50 | Set opacity to 50 for ratings 3; default opacity to other ratings |
202200

203201
---
@@ -211,9 +209,9 @@ You can also specify multiple ratings in a single value if you wish to target mu
211209
| criterion | r | Rating-based |
212210
| value | 96,90,88/70,60 | Use ratings 96, 90, 88 or 70, 60 |
213211
| style | #0fff00/#000cff | Apply #0fff00 color to ratings 96, 90, 88; #000cff color to ratings 70, 60 |
214-
| gradient-opts | | Use default gradient options |
215-
| hover-opts | | Use default hover options |
216-
| card-opts | | Use default card options |
212+
| gradient-opts | | No gradient |
213+
| hover-opts | | No hover effect |
214+
| card-opts | | Use default values |
217215

218216
## Style Presets
219217

@@ -223,16 +221,26 @@ These presets provide predefined styles for quick and easy customization.
223221

224222
![Default](/plugins/hotCards/assets/default.png)
225223

226-
You can specify '\_\_default' for the card type you want the **default** preset to be applied and it will use the configured Tag ID or Rating Threshold. You can also leave the field empty and the default style will be applied anyway.
224+
You can specify `__default` for the card type you want the **default** preset to be applied and it will use the configured Tag ID or Rating Threshold. You can also leave the field empty and the default style will be applied anyway.
227225

228226
### Hot
229227

230228
![Hot](/plugins/hotCards/assets/hot.png)
231229

232-
You can specify '\_\_hot' for the card type you want the **hot** preset to be applied and it will use the configured Tag ID or Rating Threshold.
230+
You can specify `__hot` for the card type you want the **hot** preset to be applied and it will use the configured Tag ID or Rating Threshold.
233231

234232
### Gold
235233

236234
![Gold](/plugins/hotCards/assets/gold.png)
237235

238-
You can specify '\_\_gold' for the card type you want the **gold** preset to be applied and it will use the configured Tag ID or Rating Threshold.
236+
You can specify `__gold` for the card type you want the **gold** preset to be applied and it will use the configured Tag ID or Rating Threshold.
237+
238+
### Holo
239+
240+
![Holo](/plugins/hotCards/assets/holo.png)
241+
242+
**Important**: Currently, the Holo style preset only works well with **performer** cards. It should not be used with any other card type until a workaround is found.
243+
244+
You can specify `__holo` for the card type you want the **holo** preset to be applied and it will use the configured Tag ID or Rating Threshold.
245+
246+
**Note**: _By default, the animation of the holographic effect is disabled, you can activate it by running: `__holo___,,true`._

plugins/hotCards/assets/holo.png

190 KB
Loading
128 KB
Loading

plugins/hotCards/hotCards.css

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
height: auto;
1010
}
1111

12-
.hot-card::after {
12+
.hot-card:after {
1313
z-index: -1;
1414
}
1515

@@ -20,6 +20,131 @@
2020
animation: none !important;
2121
}
2222

23+
.holo {
24+
--img: url("https://raw.githubusercontent.com/stashapp/CommunityScripts/main/plugins/hotCards/assets/illusion.webp");
25+
--posx: 50%;
26+
--posy: 50%;
27+
--hyp: 0.2;
28+
--o: 1;
29+
--mx: 50%;
30+
--my: 50%;
31+
--radius: 4.55% / 3.5%;
32+
--space: 1%; /* 5% */
33+
--angle: 133deg;
34+
--imgsize: 50%;
35+
36+
--color1: rgb(255, 119, 115) calc(var(--space) * 1);
37+
--color2: rgba(255, 237, 95, 1) calc(var(--space) * 2);
38+
--color3: rgba(168, 255, 95, 1) calc(var(--space) * 3);
39+
--color4: rgba(131, 255, 247, 1) calc(var(--space) * 4);
40+
--color5: rgba(120, 148, 255, 1) calc(var(--space) * 5);
41+
--color6: rgb(216, 117, 255) calc(var(--space) * 6);
42+
--color7: rgb(255, 119, 115) calc(var(--space) * 7);
43+
44+
display: grid;
45+
}
46+
47+
.holo-img {
48+
grid-area: 1/1;
49+
}
50+
51+
.shine {
52+
height: 100%;
53+
aspect-ratio: 0.714;
54+
mix-blend-mode: color-dodge;
55+
background-image: var(--img),
56+
repeating-linear-gradient(
57+
0deg,
58+
var(--color1),
59+
var(--color2),
60+
var(--color3),
61+
var(--color4),
62+
var(--color5),
63+
var(--color6),
64+
var(--color7)
65+
),
66+
repeating-linear-gradient(
67+
var(--angle),
68+
#0e152e 0%,
69+
hsl(180, 10%, 60%) 3.8%,
70+
hsl(180, 29%, 66%) 4.5%,
71+
hsl(180, 10%, 60%) 5.2%,
72+
#0e152e 10%,
73+
#0e152e 12%
74+
),
75+
radial-gradient(
76+
farthest-corner circle at var(--mx) var(--my),
77+
rgba(0, 0, 0, 0.1) 12%,
78+
rgba(0, 0, 0, 0.15) 20%,
79+
rgba(0, 0, 0, 0.25) 120%
80+
);
81+
background-blend-mode: exclusion, hue, hard-light, exclusion;
82+
background-size:
83+
var(--imgsize),
84+
200% 700%,
85+
300%,
86+
200%;
87+
background-position:
88+
center,
89+
0% var(--posy),
90+
var(--posx) var(--posy),
91+
var(--posx) var(--posy);
92+
filter: brightness(calc((var(--hyp) * 0.3) + 0.5)) contrast(2) saturate(1.5);
93+
-webkit-filter: brightness(calc((var(--hyp) * 0.3) + 0.5)) contrast(2)
94+
saturate(1.5);
95+
display: grid;
96+
grid-area: 1/1;
97+
opacity: var(--o);
98+
}
99+
100+
.shine:after {
101+
content: "";
102+
visibility: visible;
103+
height: 100%;
104+
aspect-ratio: 0.714;
105+
mix-blend-mode: exclusion;
106+
background-image: var(--img),
107+
repeating-linear-gradient(
108+
0deg,
109+
var(--color1),
110+
var(--color2),
111+
var(--color3),
112+
var(--color4),
113+
var(--color5),
114+
var(--color6),
115+
var(--color7)
116+
),
117+
repeating-linear-gradient(
118+
var(--angle),
119+
#0e152e 0%,
120+
hsl(180, 10%, 60%) 3.8%,
121+
hsl(180, 29%, 66%) 4.5%,
122+
hsl(180, 10%, 60%) 5.2%,
123+
#0e152e 10%,
124+
#0e152e 12%
125+
),
126+
radial-gradient(
127+
farthest-corner circle at var(--mx) var(--my),
128+
rgba(0, 0, 0, 0.1) 12%,
129+
rgba(0, 0, 0, 0.15) 20%,
130+
rgba(0, 0, 0, 0.25) 120%
131+
);
132+
background-blend-mode: exclusion, hue, hard-light, exclusion;
133+
background-size:
134+
var(--imgsize),
135+
200% 400%,
136+
195%,
137+
200%;
138+
background-position:
139+
center,
140+
0% var(--posy),
141+
calc(var(--posx) * -1) calc(var(--posy) * -1),
142+
var(--posx) var(--posy);
143+
filter: brightness(calc((var(--hyp) * 0.5) + 0.8)) contrast(1.6) saturate(1.4);
144+
-webkit-filter: brightness(calc((var(--hyp) * 0.5) + 0.8)) contrast(1.6)
145+
saturate(1.4);
146+
}
147+
23148
@keyframes pulse {
24149
0% {
25150
box-shadow: 0 0 0 0 rgba(255, 36, 9, 0);
@@ -46,6 +171,18 @@
46171
}
47172
}
48173

174+
@media (max-width: 576px) {
175+
.hot-card {
176+
width: 100%;
177+
}
178+
}
179+
180+
@media (max-width: 576px) and (orientation: portrait) {
181+
div[class*=" hot-performer-card"] {
182+
width: 14rem;
183+
}
184+
}
185+
49186
@media (prefers-reduced-motion: reduce) {
50187
.hot-card {
51188
animation: none;

0 commit comments

Comments
 (0)