Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -493,13 +493,32 @@ input[type=range] { accent-color: #c2410c; }
|
|
| 493 |
|
| 494 |
# โโ JAVASCRIPT (theme switcher + prompt enhancer hint) โโโโโโโโโโโโโโโโโโโโโโโโ
|
| 495 |
|
|
|
|
|
|
|
| 496 |
JS_INIT = """
|
| 497 |
function() {
|
| 498 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 499 |
document.documentElement.style.setProperty('--drex-acc', '#c2410c');
|
| 500 |
}
|
| 501 |
"""
|
| 502 |
-
|
| 503 |
# โโ GRADIO UI โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 504 |
|
| 505 |
with gr.Blocks(title="D-REX Studio") as app:
|
|
@@ -528,30 +547,34 @@ with gr.Blocks(title="D-REX Studio") as app:
|
|
| 528 |
with gr.Row():
|
| 529 |
gr.LoginButton(scale=0)
|
| 530 |
|
|
|
|
| 531 |
# โโ THEME BAR โโ
|
| 532 |
with gr.Row():
|
| 533 |
theme_selector = gr.HTML("""
|
| 534 |
<div id="theme-bar">
|
| 535 |
<span style="font-size:10px;font-family:monospace;color:#524e4a;margin-right:4px">THEME</span>
|
| 536 |
-
|
| 537 |
-
<span class="theme-dot" style="background:#
|
| 538 |
-
|
| 539 |
-
<span class="theme-dot" style="background:#
|
| 540 |
-
|
| 541 |
-
<span class="theme-dot" style="background:#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 542 |
<span style="font-size:10px;font-family:monospace;color:#524e4a;margin-left:8px">CUSTOM</span>
|
| 543 |
</div>
|
|
|
|
| 544 |
<div style="display:flex;justify-content:center;gap:8px;margin-bottom:12px">
|
| 545 |
<input id="custom-theme-hex" type="text" maxlength="7" placeholder="#hex color"
|
| 546 |
style="width:100px;background:#1a1816;border:1px solid #272422;border-radius:5px;
|
| 547 |
padding:4px 8px;font-size:11px;font-family:monospace;color:#f0ebe5;outline:none"/>
|
| 548 |
-
<button onclick="
|
| 549 |
-
const v=document.getElementById('custom-theme-hex').value.trim();
|
| 550 |
-
if(/^#[0-9a-fA-F]{6}$/.test(v)){
|
| 551 |
-
document.querySelectorAll('button.primary').forEach(b=>b.style.background=v);
|
| 552 |
-
document.querySelectorAll('input[type=range]').forEach(r=>r.style.accentColor=v);
|
| 553 |
-
document.documentElement.style.setProperty('--drex-acc',v);
|
| 554 |
-
}"
|
| 555 |
style="background:#1a1816;border:1px solid #272422;border-radius:5px;
|
| 556 |
padding:4px 12px;font-size:11px;font-family:monospace;color:#9a9088;cursor:pointer">
|
| 557 |
apply
|
|
|
|
| 493 |
|
| 494 |
# โโ JAVASCRIPT (theme switcher + prompt enhancer hint) โโโโโโโโโโโโโโโโโโโโโโโโ
|
| 495 |
|
| 496 |
+
JS_INIT = """
|
| 497 |
+
# โโ JAVASCRIPT โโ
|
| 498 |
JS_INIT = """
|
| 499 |
function() {
|
| 500 |
+
// เฎชเฏเฎคเฏ เฎชเฎเฏเฎเฏเฎทเฎฉเฏ: เฎเฎคเฏ เฎเฎฒเฏเฎฒเฎพ เฎชเฎฟเฎฐเฏเฎฎเฎฐเฎฟ เฎเฎฒเฎฐเฏเฎเฎณเฏเฎฏเฏเฎฎเฏ เฎฎเฎพเฎคเฏเฎคเฏเฎฎเฏ
|
| 501 |
+
window.applyTheme = function(color) {
|
| 502 |
+
if(!color.startsWith('#')) return;
|
| 503 |
+
|
| 504 |
+
// CSS Variables-เฎ เฎฎเฎพเฎฑเฏเฎฑเฏเฎคเฎฒเฏ
|
| 505 |
+
document.documentElement.style.setProperty('--drex-acc', color);
|
| 506 |
+
|
| 507 |
+
// เฎชเฎเฏเฎเฎฉเฏเฎเฎณเฏ เฎฎเฎฑเฏเฎฑเฏเฎฎเฏ เฎธเฏเฎฒเฏเฎเฎฐเฏเฎเฎณเฏ เฎฎเฎพเฎฑเฏเฎฑเฏเฎคเฎฒเฏ
|
| 508 |
+
const style = document.createElement('style');
|
| 509 |
+
style.innerHTML = `
|
| 510 |
+
button.primary { background: ${color} !important; }
|
| 511 |
+
input[type=range] { accent-color: ${color} !important; }
|
| 512 |
+
.theme-dot.selected { border-color: white !important; }
|
| 513 |
+
#lora-gallery .thumbnail-item.selected { border-color: ${color} !important; box-shadow: 0 0 0 1px ${color} !important; }
|
| 514 |
+
.tab-nav button.selected { color: ${color} !important; border-bottom-color: ${color} !important; }
|
| 515 |
+
`;
|
| 516 |
+
document.head.appendChild(style);
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
document.documentElement.style.setProperty('--drex-acc', '#c2410c');
|
| 520 |
}
|
| 521 |
"""
|
|
|
|
| 522 |
# โโ GRADIO UI โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 523 |
|
| 524 |
with gr.Blocks(title="D-REX Studio") as app:
|
|
|
|
| 547 |
with gr.Row():
|
| 548 |
gr.LoginButton(scale=0)
|
| 549 |
|
| 550 |
+
# โโ THEME BAR โโ
|
| 551 |
# โโ THEME BAR โโ
|
| 552 |
with gr.Row():
|
| 553 |
theme_selector = gr.HTML("""
|
| 554 |
<div id="theme-bar">
|
| 555 |
<span style="font-size:10px;font-family:monospace;color:#524e4a;margin-right:4px">THEME</span>
|
| 556 |
+
|
| 557 |
+
<span class="theme-dot" style="background:#c2410c" title="Orange Red"
|
| 558 |
+
onclick="applyTheme('#c2410c')"></span>
|
| 559 |
+
<span class="theme-dot" style="background:#7c3aed" title="Violet"
|
| 560 |
+
onclick="applyTheme('#7c3aed')"></span>
|
| 561 |
+
<span class="theme-dot" style="background:#0369a1" title="Ocean"
|
| 562 |
+
onclick="applyTheme('#0369a1')"></span>
|
| 563 |
+
<span class="theme-dot" style="background:#047857" title="Emerald"
|
| 564 |
+
onclick="applyTheme('#047857')"></span>
|
| 565 |
+
<span class="theme-dot" style="background:#be185d" title="Rose"
|
| 566 |
+
onclick="applyTheme('#be185d')"></span>
|
| 567 |
+
<span class="theme-dot" style="background:#b45309" title="Amber"
|
| 568 |
+
onclick="applyTheme('#b45309')"></span>
|
| 569 |
+
|
| 570 |
<span style="font-size:10px;font-family:monospace;color:#524e4a;margin-left:8px">CUSTOM</span>
|
| 571 |
</div>
|
| 572 |
+
|
| 573 |
<div style="display:flex;justify-content:center;gap:8px;margin-bottom:12px">
|
| 574 |
<input id="custom-theme-hex" type="text" maxlength="7" placeholder="#hex color"
|
| 575 |
style="width:100px;background:#1a1816;border:1px solid #272422;border-radius:5px;
|
| 576 |
padding:4px 8px;font-size:11px;font-family:monospace;color:#f0ebe5;outline:none"/>
|
| 577 |
+
<button onclick="applyTheme(document.getElementById('custom-theme-hex').value.trim())"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 578 |
style="background:#1a1816;border:1px solid #272422;border-radius:5px;
|
| 579 |
padding:4px 12px;font-size:11px;font-family:monospace;color:#9a9088;cursor:pointer">
|
| 580 |
apply
|