derek-thomas HF staff ysharma HF staff commited on
Commit
8f11653
1 Parent(s): 46a475d

to set it to 'always dark' theme (#1)

Browse files

- to set it to 'always dark' theme (3a175f6e4e1d30499a61b416bc5f68d16fdf7842)


Co-authored-by: yuvraj sharma <[email protected]>

Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -15,14 +15,21 @@ def log_file_to_html_string():
15
 
16
  return html_content
17
 
18
- theme = gr.themes.Default().set(
19
- body_background_fill="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
20
- body_background_fill_dark="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
21
- )
22
 
23
  with gr.Blocks() as demo:
24
  name = gr.Markdown("# Reddit Scraper")
25
  output = gr.HTML(log_file_to_html_string, every=1)
 
 
 
 
 
 
 
26
 
27
  if __name__ == '__main__':
28
  demo.load(None,
 
15
 
16
  return html_content
17
 
18
+ #theme = gr.themes.Default().set(
19
+ # body_background_fill="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
20
+ # body_background_fill_dark="repeating-linear-gradient(45deg, *primary_800, *primary_800 10px, *primary_900 10px, *primary_900 20px)",
21
+ # )
22
 
23
  with gr.Blocks() as demo:
24
  name = gr.Markdown("# Reddit Scraper")
25
  output = gr.HTML(log_file_to_html_string, every=1)
26
+ demo.load(None,
27
+ _js="""
28
+ () => {
29
+ document.body.classList.toggle('dark');
30
+ document.querySelector('gradio-app').style.backgroundColor = 'var(--color-background-primary)'
31
+ }
32
+ """,)
33
 
34
  if __name__ == '__main__':
35
  demo.load(None,