Skip to content

Commit

Permalink
Fix code issue in random color generation
Browse files Browse the repository at this point in the history
  • Loading branch information
wenijinew committed Sep 18, 2023
1 parent 026580d commit 71e2afd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dynamic_palette.txt
glamour.py.log
tmux_commands.txt
__pycache__
.requirements.installed.txt
6 changes: 3 additions & 3 deletions palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ def generate_random_colors(n_colors=1, hue=None, saturation=None, lightness=None
# Set the saturation to a constant value (0.5 for moderate saturation)
# Vary the lightness from 0.2 to 0.5 for dark colors

hue = hue or random.random()
saturation = saturation or 0.5
lightness = lightness or (0.2 + hue * 0.3)
hue = hue if hue is not None else random.random()
saturation = saturation if saturation is not None else 0.5
lightness = lightness if lightness is not None else (0.2 + hue * 0.3)

hex_color = hls2hex((hue, lightness, saturation))
dark_colors.append(hex_color)
Expand Down

0 comments on commit 71e2afd

Please sign in to comment.