Skip to content

Commit d4de4ab

Browse files
Merge pull request AUTOMATIC1111#3 from BinaryQuantumSoul/BinaryQuantumSoul-patch-3
New colorful noPreview images
2 parents 5e73255 + 6f5042a commit d4de4ab

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

html/card-no-preview.png

436 KB
Loading

javascript/base.css

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
104104
.extra-network-cards .card:hover .actions { display: block; }
105105
.extra-network-cards .card:hover .overlay .tags { display: block; }
106106
.extra-network-cards .card .actions { font-size: 3em; display: none; text-align-last: right; cursor: pointer; font-variant: unicase; position: absolute; z-index: 100; right: 0; height: 0.7em; width: 100%; background: rgba(0, 0, 0, 0.40); }
107+
.extra-network-cards .card:has(>img[src*="card-no-preview.png"])::after { content: ''; position: absolute; width: 100%; height: 100%; opacity: 0.5; mix-blend-mode: multiply; background-color: var(--data-color); }
107108
#txt2img_description, #img2img_description { max-height: 63px; overflow-y: auto !important; }
108109
#txt2img_description > label > textarea, #img2img_description > label > textarea { font-size: 0.9em }
109110

modules/ui_extra_networks.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import io
3+
import random
34
import re
45
import time
56
import json
@@ -26,7 +27,7 @@
2627
debug = shared.log.trace if os.environ.get('SD_EN_DEBUG', None) is not None else lambda *args, **kwargs: None
2728
debug('Trace: EN')
2829
card_full = '''
29-
<div class='card' onclick={card_click} title='{name}' data-tab='{tabname}' data-page='{page}' data-name='{name}' data-filename='{filename}' data-tags='{tags}' data-mtime='{mtime}' data-size='{size}' data-search='{search}'>
30+
<div class='card' onclick={card_click} title='{name}' data-tab='{tabname}' data-page='{page}' data-name='{name}' data-filename='{filename}' data-tags='{tags}' data-mtime='{mtime}' data-size='{size}' data-search='{search}' style='--data-color: {color}'>
3031
<div class='overlay'>
3132
<div class='tags'></div>
3233
<div class='name'>{title}</div>
@@ -279,6 +280,12 @@ def allowed_directories_for_previews(self):
279280
return []
280281

281282
def create_html(self, item, tabname):
283+
def random_bright_color():
284+
r = random.randint(100, 255)
285+
g = random.randint(100, 255)
286+
b = random.randint(100, 255)
287+
return '#{:02x}{:02x}{:02x}'.format(r, g, b)
288+
282289
try:
283290
args = {
284291
"tabname": tabname,
@@ -297,6 +304,7 @@ def create_html(self, item, tabname):
297304
"card_click": item.get("onclick", '"' + html.escape(f'return cardClicked({item.get("prompt", None)}, {"true" if self.allow_negative_prompt else "false"})') + '"'),
298305
"mtime": item.get("mtime", 0),
299306
"size": item.get("size", 0),
307+
"color": random_bright_color(),
300308
}
301309
alias = item.get("alias", None)
302310
if alias is not None:

0 commit comments

Comments
 (0)