AlGe commited on
Commit
131c9ed
·
verified ·
1 Parent(s): 3c72f0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -26,16 +26,19 @@ def adjust_brightness(rgb_color: tuple[int, int, int], factor: float) -> tuple[i
26
 
27
  class MPGPoster(Base):
28
  @staticmethod
29
- def create_color_shades(hex_color: str) -> colors.Color:
30
  base_rgb = hex_to_rgb(hex_color)
31
  shades = {}
32
- # Define brightness factors for shades
33
- factors = {
34
  "c50": 1.6, "c100": 1.4, "c200": 1.3,
35
  "c300": 1.2, "c400": 1, "c500": 0.8,
36
  "c600": 0.5, "c700": 0.35, "c800": 0.2,
37
  "c900": 0.15, "c950": 0.1
38
  }
 
 
 
39
  for shade, factor in factors.items():
40
  new_rgb = adjust_brightness(base_rgb, factor)
41
  shades[shade] = rgb_to_hex(new_rgb)
@@ -65,8 +68,8 @@ class MPGPoster(Base):
65
  primary_hue = MPGPoster.create_color_shades("#f47317") #orange
66
  background_hue = MPGPoster.create_color_shades("#006c66") ##f6f6f6ff green
67
  secondary_dark_hue = MPGPoster.create_color_shades("#6ad5bc") #006c66
68
- secondary_light_hue = MPGPoster.create_color_shades("#fbf22c") #6ad5bc
69
- tertiary_highlight_hue = MPGPoster.create_color_shades("#6ad5bc") #fbf22c
70
 
71
  super().__init__(
72
  primary_hue=primary_hue,
 
26
 
27
  class MPGPoster(Base):
28
  @staticmethod
29
+ def create_color_shades(hex_color: str, brightness_control: float = 1.0) -> colors.Color:
30
  base_rgb = hex_to_rgb(hex_color)
31
  shades = {}
32
+ # Define base brightness factors for shades
33
+ base_factors = {
34
  "c50": 1.6, "c100": 1.4, "c200": 1.3,
35
  "c300": 1.2, "c400": 1, "c500": 0.8,
36
  "c600": 0.5, "c700": 0.35, "c800": 0.2,
37
  "c900": 0.15, "c950": 0.1
38
  }
39
+ # Adjust brightness factors based on brightness_control
40
+ factors = {shade: factor * brightness_control for shade, factor in base_factors.items()}
41
+
42
  for shade, factor in factors.items():
43
  new_rgb = adjust_brightness(base_rgb, factor)
44
  shades[shade] = rgb_to_hex(new_rgb)
 
68
  primary_hue = MPGPoster.create_color_shades("#f47317") #orange
69
  background_hue = MPGPoster.create_color_shades("#006c66") ##f6f6f6ff green
70
  secondary_dark_hue = MPGPoster.create_color_shades("#6ad5bc") #006c66
71
+ #secondary_light_hue = MPGPoster.create_color_shades("#fbf22c") #6ad5bc
72
+ #tertiary_highlight_hue = MPGPoster.create_color_shades("#6ad5bc") #fbf22c
73
 
74
  super().__init__(
75
  primary_hue=primary_hue,