Spaces:
Running
Running
Sebastiankay
commited on
Commit
•
108bf71
1
Parent(s):
cb1f559
24. Sept. 2024, 22:09
Browse files- _res/_custom.js +4 -2
_res/_custom.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
function gradioCustomJS() {
|
2 |
console.log("gradioCustomJS Started")
|
3 |
|
|
|
|
|
4 |
// MARK: DOM Change Detection
|
5 |
function onDomChange(callback) {
|
6 |
const observer = new MutationObserver(callback)
|
@@ -17,7 +19,8 @@ function gradioCustomJS() {
|
|
17 |
document.querySelector("body > gradio-app > div").classList.add("fade-bg")
|
18 |
document.querySelector("gradio-app").style.opacity = "0"
|
19 |
setTimeout(() => {
|
20 |
-
|
|
|
21 |
document.querySelector("gradio-app").classList.add("has-bg-image")
|
22 |
document.querySelector("body").style.setProperty("--bg-image-path", `url("${document.querySelector("#output_image > div.image-container.svelte-1p15vfy > button > div > img").src}")`)
|
23 |
}, 400)
|
@@ -66,7 +69,6 @@ function gradioCustomJS() {
|
|
66 |
body.className = "dark"
|
67 |
|
68 |
// Catppuccin colors
|
69 |
-
const usedColor = "rgb(250, 179, 135)"
|
70 |
body.style.setProperty("--cat-rosewater", "rgb(245, 224, 220)")
|
71 |
body.style.setProperty("--cat-flamingo", "rgb(242, 205, 205)")
|
72 |
body.style.setProperty("--cat-pink", "rgb(245, 194, 231)")
|
|
|
1 |
function gradioCustomJS() {
|
2 |
console.log("gradioCustomJS Started")
|
3 |
|
4 |
+
let usedColor = "rgb(250, 179, 135)"
|
5 |
+
|
6 |
// MARK: DOM Change Detection
|
7 |
function onDomChange(callback) {
|
8 |
const observer = new MutationObserver(callback)
|
|
|
19 |
document.querySelector("body > gradio-app > div").classList.add("fade-bg")
|
20 |
document.querySelector("gradio-app").style.opacity = "0"
|
21 |
setTimeout(() => {
|
22 |
+
usedColor = document.querySelector("#dominant_image_color > label > textarea").value
|
23 |
+
document.querySelector("body").style.setProperty("--primary-600", usedColor)
|
24 |
document.querySelector("gradio-app").classList.add("has-bg-image")
|
25 |
document.querySelector("body").style.setProperty("--bg-image-path", `url("${document.querySelector("#output_image > div.image-container.svelte-1p15vfy > button > div > img").src}")`)
|
26 |
}, 400)
|
|
|
69 |
body.className = "dark"
|
70 |
|
71 |
// Catppuccin colors
|
|
|
72 |
body.style.setProperty("--cat-rosewater", "rgb(245, 224, 220)")
|
73 |
body.style.setProperty("--cat-flamingo", "rgb(242, 205, 205)")
|
74 |
body.style.setProperty("--cat-pink", "rgb(245, 194, 231)")
|