gsbm commited on
Commit
70a4030
·
verified ·
1 Parent(s): 6188ed4

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +10 -8
run.py CHANGED
@@ -31,7 +31,7 @@ def compute(primary_color, secondary_color, neutral_color):
31
  neutral_shades = [adjust_brightness(neutral_color, p) for p in [-90, -75, -50, -25, -10, 0, 10, 25, 50, 75, 90]]
32
 
33
  css = f"""
34
- :root \{
35
  --primary-50: {primary_shades[0]} !important;
36
  --primary-100: {primary_shades[1]} !important;
37
  --primary-200: {primary_shades[2]} !important;
@@ -65,19 +65,21 @@ def compute(primary_color, secondary_color, neutral_color):
65
  --neutral-800: {neutral_shades[8]} !important;
66
  --neutral-900: {neutral_shades[9]} !important;
67
  --neutral-950: {neutral_shades[10]} !important;
68
- \}"""
69
 
70
  return css
71
 
72
  with gr.Blocks(css="") as demo:
 
 
 
 
 
 
73
  gr.Interface(
74
  fn=compute,
75
- inputs=[
76
- gr.ColorPicker(label="Primary color", value="#f97316"),
77
- gr.ColorPicker(label="Secondary color", value="#3b82f6"),
78
- gr.ColorPicker(label="Neutral color", value="#6b7280")
79
- ],
80
- outputs=[gr.Textbox(label="Custom css", lines=3)],
81
  )
82
 
83
  if __name__ == "__main__":
 
31
  neutral_shades = [adjust_brightness(neutral_color, p) for p in [-90, -75, -50, -25, -10, 0, 10, 25, 50, 75, 90]]
32
 
33
  css = f"""
34
+ :root {{
35
  --primary-50: {primary_shades[0]} !important;
36
  --primary-100: {primary_shades[1]} !important;
37
  --primary-200: {primary_shades[2]} !important;
 
65
  --neutral-800: {neutral_shades[8]} !important;
66
  --neutral-900: {neutral_shades[9]} !important;
67
  --neutral-950: {neutral_shades[10]} !important;
68
+ }}"""
69
 
70
  return css
71
 
72
  with gr.Blocks(css="") as demo:
73
+ primary_color_input = gr.ColorPicker(label="Primary color", value="#f97316")
74
+ secondary_color_input = gr.ColorPicker(label="Secondary color", value="#3b82f6")
75
+ neutral_color_input = gr.ColorPicker(label="Neutral color", value="#6b7280")
76
+
77
+ css_output = gr.Textbox(label="Custom css", lines=10)
78
+
79
  gr.Interface(
80
  fn=compute,
81
+ inputs=[primary_color_input, secondary_color_input, neutral_color_input],
82
+ outputs=[css_output],
 
 
 
 
83
  )
84
 
85
  if __name__ == "__main__":