Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Save/load categorical palettes via URL #190

Merged
merged 4 commits into from
Feb 2, 2024

Conversation

ShrimpCryptid
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid commented Jan 22, 2024

Problem

Closes #148! This is the last implementation detail for categorical features!

Solution

  • Adds a new URL parameter for the categorical palette, and associated unit tests.
    • If an existing palette was chosen, saves the palette's key ("palette-key=adobe").
    • If the palette is different for any color, saves the hex value of all 12 colors in the palette ("?palette=000000-000010-000020-000030-000040-000050-000060-000070-000080-000090-0000a0-0000b0").

Note: I would have loved to shorten the URLs further, so I made a separate issue ticket for that: #191

Type of change

  • New feature (non-breaking change which adds functionality)

Steps to Verify:

  1. Open the preview link: https://allen-cell-animated.github.io/nucmorph-colorizer/pr-preview/pr-190/?dataset=https%3A%2F%2Fdev-aics-dtp-001.int.allencell.org%2Fdan-data%2Fcolorizer%2Fdata%2Ftest%2F3500005828_25%2Fmanifest.json&feature=Cell%20type&t=78
  2. Change the palette to another preset.
  3. Copy the URL and open it in a new tab. The palette should be loaded correctly.
  4. Edit one or more colors in the palette.
  5. Copying the URL and opening it in a new tab should keep the changes to the palette.

Example:
image
https://allen-cell-animated.github.io/nucmorph-colorizer/pr-preview/pr-190/?dataset=https%3A%2F%2Fdev-aics-dtp-001.int.allencell.org%2Fdan-data%2Fcolorizer%2Fdata%2Ftest%2F3500005828_25%2Fmanifest.json&feature=Cell%20type&t=78&color=matplotlib-cool&palette=eacb70-9a65dc-e75c5c-ffffa4-3a6cac-5d5d6a-bd5d26-ed1b7d-9467bd-f25fa4-7598c5-a8d9aa

@ShrimpCryptid ShrimpCryptid added the new feature New feature or request label Jan 22, 2024
Copy link

github-actions bot commented Jan 22, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 61.15% 3283 / 5368
🔵 Statements 61.15% 3283 / 5368
🔵 Functions 47.53% 77 / 162
🔵 Branches 78.68% 240 / 305
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/colorizer/colors/categorical_palettes.ts 100% 100% 100% 100%
src/colorizer/utils/url_utils.ts 90.47% 95.71% 76.47% 90.47% 55-61, 112-118, 148-159, 258-261, 300-307, 345-348
Generated in workflow #565

Copy link

github-actions bot commented Jan 22, 2024

PR Preview Action v1.4.6
Preview removed because the pull request was closed.
2024-02-02 21:59 UTC

@ShrimpCryptid ShrimpCryptid self-assigned this Jan 22, 2024
@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review January 22, 2024 22:22
@ShrimpCryptid ShrimpCryptid requested a review from a team as a code owner January 22, 2024 22:22
@ShrimpCryptid ShrimpCryptid added ux-implementation UX research completed, this ticket is ready for implementation. and removed new feature New feature or request labels Jan 22, 2024
Copy link
Contributor

@frasercl frasercl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ShrimpCryptid ShrimpCryptid merged commit 067a3a3 into main Feb 2, 2024
2 checks passed
@ShrimpCryptid ShrimpCryptid deleted the feature/palette-urls branch February 2, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ux-implementation UX research completed, this ticket is ready for implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UX Implementation for categorical features
3 participants