Sebastiankay commited on
Commit
99347a0
1 Parent(s): 6fd5a82

Sep 10, 2024, 11:02 AM

Browse files
Files changed (1) hide show
  1. _res/_custom.js +17 -13
_res/_custom.js CHANGED
@@ -1,4 +1,6 @@
1
- function gradioColorChange() {
 
 
2
  function onDomChange(callback) {
3
  const observer = new MutationObserver(callback)
4
  observer.observe(document.querySelector("#dominant_image_color"), {
@@ -30,17 +32,19 @@ function gradioColorChange() {
30
  //document.querySelector("body").style.setProperty("--primary-700", document.querySelector("#dominant_image_color > label > textarea").value)
31
  })
32
 
33
- document.querySelector("body").style.setProperty("--primary-700", "rgb(250, 179, 135)")
34
- document.querySelector("body").style.setProperty("--primary-50", "color-mix(in srgb, var(--primary-700) 5%, white)")
35
- document.querySelector("body").style.setProperty("--primary-100", "color-mix(in srgb, var(--primary-700) 10%, white)")
36
- document.querySelector("body").style.setProperty("--primary-200", "color-mix(in srgb, var(--primary-700) 20%, white)")
37
- document.querySelector("body").style.setProperty("--primary-300", "color-mix(in srgb, var(--primary-700) 60%, white)")
38
- document.querySelector("body").style.setProperty("--primary-400", "color-mix(in srgb, var(--primary-700) 70%, white)")
39
- document.querySelector("body").style.setProperty("--primary-500", "color-mix(in srgb, var(--primary-700) 80%, white)")
40
- document.querySelector("body").style.setProperty("--primary-600", "color-mix(in srgb, var(--primary-700) 90%, white)")
41
- document.querySelector("body").style.setProperty("--primary-800", "color-mix(in srgb, var(--primary-700) 70%, black)")
42
- document.querySelector("body").style.setProperty("--primary-900", "color-mix(in srgb, var(--primary-700) 80%, black)")
43
- document.querySelector("body").style.setProperty("--primary-950", "color-mix(in srgb, var(--primary-700) 90%, black)")
 
 
44
 
45
  const prompt_input = document.querySelector("#prompt_input")
46
  prompt_input.setAttribute("autocomplete", "off")
@@ -114,5 +118,5 @@ function gradioColorChange() {
114
  // })
115
  // })
116
 
117
- return "Animation created"
118
  }
 
1
+ function gradioCustomJS() {
2
+ console.log("gradioCustomJS Started")
3
+
4
  function onDomChange(callback) {
5
  const observer = new MutationObserver(callback)
6
  observer.observe(document.querySelector("#dominant_image_color"), {
 
32
  //document.querySelector("body").style.setProperty("--primary-700", document.querySelector("#dominant_image_color > label > textarea").value)
33
  })
34
 
35
+ const body = document.querySelector("body")
36
+ body.className = "dark"
37
+ body.style.setProperty("--primary-700", "rgb(250, 179, 135)")
38
+ body.style.setProperty("--primary-50", "color-mix(in srgb, var(--primary-700) 5%, white)")
39
+ body.style.setProperty("--primary-100", "color-mix(in srgb, var(--primary-700) 10%, white)")
40
+ body.style.setProperty("--primary-200", "color-mix(in srgb, var(--primary-700) 20%, white)")
41
+ body.style.setProperty("--primary-300", "color-mix(in srgb, var(--primary-700) 60%, white)")
42
+ body.style.setProperty("--primary-400", "color-mix(in srgb, var(--primary-700) 70%, white)")
43
+ body.style.setProperty("--primary-500", "color-mix(in srgb, var(--primary-700) 80%, white)")
44
+ body.style.setProperty("--primary-600", "color-mix(in srgb, var(--primary-700) 90%, white)")
45
+ body.style.setProperty("--primary-800", "color-mix(in srgb, var(--primary-700) 70%, black)")
46
+ body.style.setProperty("--primary-900", "color-mix(in srgb, var(--primary-700) 80%, black)")
47
+ body.style.setProperty("--primary-950", "color-mix(in srgb, var(--primary-700) 90%, black)")
48
 
49
  const prompt_input = document.querySelector("#prompt_input")
50
  prompt_input.setAttribute("autocomplete", "off")
 
118
  // })
119
  // })
120
 
121
+ return "Custom Gradio JS"
122
  }