Skip to content

Commit

Permalink
Removes random colors
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcarlos committed Jul 25, 2022
1 parent 711e82d commit f2740d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
4 changes: 2 additions & 2 deletions jupyter_server/auth/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from jupyter_server.transutils import _i18n

from .security import passwd_check, set_password
from .utils import get_anonymous_username, get_random_color
from .utils import get_anonymous_username

# circular imports for type checking
if TYPE_CHECKING:
Expand Down Expand Up @@ -468,7 +468,7 @@ def generate_anonymous_user(self, handler: JupyterHandler) -> User:
moon = get_anonymous_username()
name = display_name = f"Anonymous {moon}"
initials = f"A{moon[0]}"
color = get_random_color()
color = None
handler.log.info(f"Generating new user for token-authenticated request: {user_id}")
return User(user_id, name, display_name, initials, None, color)

Expand Down
17 changes: 0 additions & 17 deletions jupyter_server/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,3 @@ def get_anonymous_username() -> str:
This function returns names like "Anonymous Io" or "Anonymous Metis".
"""
return moons_of_jupyter[random.randint(0, len(moons_of_jupyter) - 1)]


# Using JupyterLab CSS variable because the colors may change with the theme
user_colors = [
"var(--jp-collaborator-color1)",
"var(--jp-collaborator-color2)",
"var(--jp-collaborator-color3)",
"var(--jp-collaborator-color4)",
"var(--jp-collaborator-color5)",
"var(--jp-collaborator-color6)",
"var(--jp-collaborator-color7)",
]


def get_random_color() -> str:
"""Get a random color from the list of colors."""
return user_colors[random.randint(0, len(user_colors) - 1)]

0 comments on commit f2740d7

Please sign in to comment.