Sebastiankay commited on
Commit
2112889
·
1 Parent(s): 9484602

24. Sept. 2024, 23:05

Browse files
Files changed (1) hide show
  1. _res/_custom.js +9 -9
_res/_custom.js CHANGED
@@ -128,22 +128,22 @@ function gradioCustomJS() {
128
  }
129
 
130
  onDomChange(() => {
131
- console.log("changed: " + dominantColorField.value)
132
- if (dominantColorField.value.match(/^rgb\((\d{1,3}),(\s\d{1,3}),(\s\d{1,3})\)$/) && outputImageElem.src) {
133
- outputImageElem.style.opacity = "0"
134
  document.querySelector("body > gradio-app > div").classList.add("fade-bg")
135
  document.querySelector("gradio-app").style.opacity = "0"
136
  setTimeout(() => {
137
- usedColor = dominantColorField.value
138
- body.style.setProperty("--primary-600", dominantColorField.value)
139
- body.style.setProperty("--text-color-by-luminance", anpasseTextfarbe(dominantColorField.value))
140
  gradioApp.classList.add("has-bg-image")
141
- body.style.setProperty("--bg-image-path", `url("${outputImageElem.src}")`)
142
  }, 400)
143
  setTimeout(() => {
144
  gradioApp.style.opacity = "1"
145
- outputImageElem.style.opacity = "1"
146
- dominantColorField.value = ""
147
  }, 800)
148
  setTimeout(() => {
149
  //document.querySelector("body > gradio-app > div").classList.remove("fade-bg")
 
128
  }
129
 
130
  onDomChange(() => {
131
+ console.log("changed: " + document.querySelector("#dominant_image_color > label > textarea").value)
132
+ if (document.querySelector("#dominant_image_color > label > textarea").value.match(/^rgb\((\d{1,3}),(\s\d{1,3}),(\s\d{1,3})\)$/) && document.querySelector("#output_image > div.image-container.svelte-1p15vfy > button > div > img").src) {
133
+ document.querySelector("#output_image > div.image-container.svelte-1p15vfy > button > div > img").style.opacity = "0"
134
  document.querySelector("body > gradio-app > div").classList.add("fade-bg")
135
  document.querySelector("gradio-app").style.opacity = "0"
136
  setTimeout(() => {
137
+ usedColor = document.querySelector("#dominant_image_color > label > textarea").value
138
+ body.style.setProperty("--primary-600", document.querySelector("#dominant_image_color > label > textarea").value)
139
+ body.style.setProperty("--text-color-by-luminance", anpasseTextfarbe(document.querySelector("#dominant_image_color > label > textarea").value))
140
  gradioApp.classList.add("has-bg-image")
141
+ body.style.setProperty("--bg-image-path", `url("${document.querySelector("#output_image > div.image-container.svelte-1p15vfy > button > div > img").src}")`)
142
  }, 400)
143
  setTimeout(() => {
144
  gradioApp.style.opacity = "1"
145
+ document.querySelector("#output_image > div.image-container.svelte-1p15vfy > button > div > img").style.opacity = "1"
146
+ document.querySelector("#dominant_image_color > label > textarea").value = ""
147
  }, 800)
148
  setTimeout(() => {
149
  //document.querySelector("body > gradio-app > div").classList.remove("fade-bg")