snapshot of https://github.com/zulip/zulip.git @ 48c69911c7dd4e03b20552eb3bd77ad8151c1357 (2026-09-15)
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
This commit is contained in:
56
zerver/lib/stream_color.py
Normal file
56
zerver/lib/stream_color.py
Normal file
@@ -0,0 +1,56 @@
|
||||
STREAM_ASSIGNMENT_COLORS = [
|
||||
"#76ce90",
|
||||
"#fae589",
|
||||
"#a6c7e5",
|
||||
"#e79ab5",
|
||||
"#bfd56f",
|
||||
"#f4ae55",
|
||||
"#b0a5fd",
|
||||
"#addfe5",
|
||||
"#f5ce6e",
|
||||
"#c2726a",
|
||||
"#94c849",
|
||||
"#bd86e5",
|
||||
"#ee7e4a",
|
||||
"#a6dcbf",
|
||||
"#95a5fd",
|
||||
"#53a063",
|
||||
"#9987e1",
|
||||
"#e4523d",
|
||||
"#c2c2c2",
|
||||
"#4f8de4",
|
||||
"#c6a8ad",
|
||||
"#e7cc4d",
|
||||
"#c8bebf",
|
||||
"#a47462",
|
||||
]
|
||||
|
||||
|
||||
def pick_colors(
|
||||
used_colors: set[str], color_map: dict[int, str], recipient_ids: list[int]
|
||||
) -> dict[int, str]:
|
||||
used_colors = set(used_colors)
|
||||
recipient_ids = sorted(recipient_ids)
|
||||
result = {}
|
||||
|
||||
other_recipient_ids = []
|
||||
for recipient_id in recipient_ids:
|
||||
if recipient_id in color_map:
|
||||
color = color_map[recipient_id]
|
||||
result[recipient_id] = color
|
||||
used_colors.add(color)
|
||||
else:
|
||||
other_recipient_ids.append(recipient_id)
|
||||
|
||||
available_colors = [s for s in STREAM_ASSIGNMENT_COLORS if s not in used_colors]
|
||||
|
||||
for i, recipient_id in enumerate(other_recipient_ids):
|
||||
if i < len(available_colors):
|
||||
color = available_colors[i]
|
||||
else:
|
||||
# We have to start reusing old colors, and we use recipient_id
|
||||
# to choose the color.
|
||||
color = STREAM_ASSIGNMENT_COLORS[recipient_id % len(STREAM_ASSIGNMENT_COLORS)]
|
||||
result[recipient_id] = color
|
||||
|
||||
return result
|
||||
Reference in New Issue
Block a user