Skip to content

Commit a55ae8f

Browse files
committed
Use less saturated colors for metro lines
1 parent 2ce6ed5 commit a55ae8f

5 files changed

Lines changed: 7 additions & 6 deletions

File tree

GAME_RULES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This document summarizes the game rules currently implemented in code.
5050
- Unlock the 4th station at 10 travels.
5151
- Then each next station requires +20 more travels than the previous unlock
5252
(5th at 40, 6th at 90, 7th at 160, ...), up to 20 stations.
53-
- Line colors are randomized at runtime each run.
53+
- Line colors are randomized at runtime each run, using a less saturated palette for softer visuals.
5454

5555
## Passenger Routing and Transfers
5656

PROGRESS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@
7575
- Updated `GAME_RULES.md` to document the station snap-blip behavior during line creation.
7676
- Added bottom-left simulation speed controls (`Pause`, `1x`, `2x`, `4x`) with clickable UI buttons wired to pause and speed state.
7777
- Switched speed-control button labels to iconography: pause bars, single play, double play, and four-play symbols.
78+
- Changed runtime-randomized metro line colors to a less saturated palette for softer visuals.

src/mediator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ def generate_distinct_path_colors(self, path_count: int) -> Dict[Color, bool]:
129129
selected_hues.append(pick_distinct_hue(selected_hues, candidate_hues))
130130
path_colors: Dict[Color, bool] = {}
131131
for hue in selected_hues:
132-
path_colors[hue_to_rgb(hue)] = False
132+
path_colors[hue_to_rgb(hue, saturation=0.6, value=0.9)] = False
133133
while len(path_colors) < path_count:
134-
path_colors[hue_to_rgb(random.random())] = False
134+
path_colors[hue_to_rgb(random.random(), saturation=0.6, value=0.9)] = False
135135
return path_colors
136136

137137
def get_path_purchase_prices(self) -> List[int]:

src/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def get_random_color() -> Color:
3333
return hue_to_rgb(np.random.rand())
3434

3535

36-
def hue_to_rgb(hue: float) -> Color:
37-
return tuple(255 * np.asarray(colorsys.hsv_to_rgb(hue, 1.0, 1.0)))
36+
def hue_to_rgb(hue: float, saturation: float = 1.0, value: float = 1.0) -> Color:
37+
return tuple(255 * np.asarray(colorsys.hsv_to_rgb(hue, saturation, value)))
3838

3939

4040
def hue_circular_distance(hue_a: float, hue_b: float) -> float:

test/test_mediator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_generate_distinct_path_colors_handles_non_positive_count(self):
102102
def test_generate_distinct_path_colors_backfills_color_collisions(self):
103103
calls = {"count": 0}
104104

105-
def fake_hue_to_rgb(_hue):
105+
def fake_hue_to_rgb(_hue, saturation=1.0, value=1.0):
106106
calls["count"] += 1
107107
if calls["count"] <= self.mediator.num_paths:
108108
return (0, 0, 0)

0 commit comments

Comments
 (0)