Spaces:
Sleeping
Sleeping
Update run.py
Browse files
run.py
CHANGED
|
@@ -29,6 +29,9 @@ def compute(primary_color, secondary_color, neutral_color):
|
|
| 29 |
primary_shades = [adjust_brightness(primary_color, p) for p in [90, 75, 50, 25, 10, 0, -10, -25, -50, -75, -90]]
|
| 30 |
secondary_shades = [adjust_brightness(secondary_color, p) for p in [90, 75, 50, 25, 10, 0, -10, -25, -50, -75, -90]]
|
| 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 {{
|
|
@@ -65,7 +68,43 @@ 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 |
|
|
@@ -104,8 +143,7 @@ with gr.Blocks() as demo:
|
|
| 104 |
outputs=[css_output, gr.HTML()],
|
| 105 |
examples=[
|
| 106 |
["#e84393", "#6c5ce7", "#b2bec3"],
|
| 107 |
-
["#38ada9", "#60a3bc", "#3c6382"]
|
| 108 |
-
["#ff793f", "#706fd3", "#aaa69d"]
|
| 109 |
]
|
| 110 |
)
|
| 111 |
|
|
|
|
| 29 |
primary_shades = [adjust_brightness(primary_color, p) for p in [90, 75, 50, 25, 10, 0, -10, -25, -50, -75, -90]]
|
| 30 |
secondary_shades = [adjust_brightness(secondary_color, p) for p in [90, 75, 50, 25, 10, 0, -10, -25, -50, -75, -90]]
|
| 31 |
neutral_shades = [adjust_brightness(neutral_color, p) for p in [90, 75, 50, 25, 10, 0, -10, -25, -50, -75, -90]]
|
| 32 |
+
dark_primary_shades = [adjust_brightness(primary_color, p) for p in [-90, -75, -50, -25, -10, 0, 10, 25, 50, 75, 90]]
|
| 33 |
+
dark_secondary_shades = [adjust_brightness(secondary_color, p) for p in [-90, -75, -50, -25, -10, 0, 10, 25, 50, 75, 90]]
|
| 34 |
+
dark_neutral_shades = [adjust_brightness(neutral_color, p) for p in [-90, -75, -50, -25, -10, 0, 10, 25, 50, 75, 90]]
|
| 35 |
|
| 36 |
css = f"""
|
| 37 |
:root {{
|
|
|
|
| 68 |
--neutral-800: {neutral_shades[8]} !important;
|
| 69 |
--neutral-900: {neutral_shades[9]} !important;
|
| 70 |
--neutral-950: {neutral_shades[10]} !important;
|
| 71 |
+
}}
|
| 72 |
+
:root.dark {{
|
| 73 |
+
--primary-50: {dark_primary_shades[0]} !important;
|
| 74 |
+
--primary-100: {dark_primary_shades[1]} !important;
|
| 75 |
+
--primary-200: {dark_primary_shades[2]} !important;
|
| 76 |
+
--primary-300: {dark_primary_shades[3]} !important;
|
| 77 |
+
--primary-400: {dark_primary_shades[4]} !important;
|
| 78 |
+
--primary-500: {dark_primary_shades[5]} !important;
|
| 79 |
+
--primary-600: {dark_primary_shades[6]} !important;
|
| 80 |
+
--primary-700: {dark_primary_shades[7]} !important;
|
| 81 |
+
--primary-800: {dark_primary_shades[8]} !important;
|
| 82 |
+
--primary-900: {dark_primary_shades[9]} !important;
|
| 83 |
+
--primary-950: {dark_primary_shades[10]} !important;
|
| 84 |
+
--secondary-50: {dark_secondary_shades[0]} !important;
|
| 85 |
+
--secondary-100: {dark_secondary_shades[1]} !important;
|
| 86 |
+
--secondary-200: {dark_secondary_shades[2]} !important;
|
| 87 |
+
--secondary-300: {dark_secondary_shades[3]} !important;
|
| 88 |
+
--secondary-400: {dark_secondary_shades[4]} !important;
|
| 89 |
+
--secondary-500: {dark_secondary_shades[5]} !important;
|
| 90 |
+
--secondary-600: {dark_secondary_shades[6]} !important;
|
| 91 |
+
--secondary-700: {dark_secondary_shades[7]} !important;
|
| 92 |
+
--secondary-800: {dark_secondary_shades[8]} !important;
|
| 93 |
+
--secondary-900: {dark_secondary_shades[9]} !important;
|
| 94 |
+
--secondary-950: {dark_secondary_shades[10]} !important;
|
| 95 |
+
--neutral-50: {dark_neutral_shades[0]} !important;
|
| 96 |
+
--neutral-100: {dark_neutral_shades[1]} !important;
|
| 97 |
+
--neutral-200: {dark_neutral_shades[2]} !important;
|
| 98 |
+
--neutral-300: {dark_neutral_shades[3]} !important;
|
| 99 |
+
--neutral-400: {dark_neutral_shades[4]} !important;
|
| 100 |
+
--neutral-500: {dark_neutral_shades[5]} !important;
|
| 101 |
+
--neutral-600: {dark_neutral_shades[6]} !important;
|
| 102 |
+
--neutral-700: {dark_neutral_shades[7]} !important;
|
| 103 |
+
--neutral-800: {dark_neutral_shades[8]} !important;
|
| 104 |
+
--neutral-900: {dark_neutral_shades[9]} !important;
|
| 105 |
+
--neutral-950: {dark_neutral_shades[10]} !important;
|
| 106 |
+
}}
|
| 107 |
+
"""
|
| 108 |
|
| 109 |
return css
|
| 110 |
|
|
|
|
| 143 |
outputs=[css_output, gr.HTML()],
|
| 144 |
examples=[
|
| 145 |
["#e84393", "#6c5ce7", "#b2bec3"],
|
| 146 |
+
["#38ada9", "#60a3bc", "#3c6382"]
|
|
|
|
| 147 |
]
|
| 148 |
)
|
| 149 |
|