Shared color scope: reuse type/track colors across datasets#1796
Open
mattdawkins wants to merge 1 commit into
Open
Shared color scope: reuse type/track colors across datasets#1796mattdawkins wants to merge 1 commit into
mattdawkins wants to merge 1 commit into
Conversation
Type/track/group color and style overrides were saved only with the dataset they were set on, so the same class could render a different color in every sequence. Add a "Type color scope" user setting with two modes: - shared (default): one set of color/style overrides is reused across every dataset. On desktop it is stored once per data directory (global_style_settings.json) and shared across all sequences; on web it is scoped to the current user/browser (localStorage). When a dataset opens, the shared styles overlay the dataset's own styling (shared wins on conflicts), any color the user edits is mirrored back to the shared store, and colors imported with a dataset seed the shared store so they propagate to future sequences. - dataset: the original behavior, colors are saved only with their dataset. Wiring: StyleManager gains an onStyleEdit hook fired on user edits; Viewer overlays/seeds/persists the shared store; a new optional loadGlobalStyleSettings/saveGlobalStyleSettings pair on the Api is implemented by both the desktop backend (file under the data dir) and the web client (localStorage). Backend read/write is unit tested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type/track/group color and style overrides were stored only in the metadata of the dataset they were set on (
customTypeStyling/customGroupStyling). The same class could therefore render a different color in every sequence, and a color a user picked never followed them to the next dataset.This adds a Type color scope user setting (User Settings dialog) with two modes:
global_style_settings.json, shared across all sequences.localStorage, consistent with how the web client already persists user preferences (clientSettings).The default is shared, so out of the box a color set once is reused everywhere. Choosing Per dataset reproduces today's exact behavior (the shared paths become no-ops).
Changes
dive-common/store/settings.ts— newtypeSettings.colorScope: 'shared' | 'dataset'(default'shared'; hydrates onto existing stored settings).dive-common/components/UserSettingsDialog.vue— a "Type color scope" select.src/StyleManager.ts— optionalonStyleEdithook, fired onupdateTypeStyle(genuine edits only, not on dataset load).dive-common/components/Viewer.vue— loads/overlays/seeds the shared store on dataset open and persists edits (debounced).dive-common/apispec.ts— newGlobalStyleSettingstype and optionalloadGlobalStyleSettings/saveGlobalStyleSettingsApi methods.backend/native/globalStyles.ts(file read/write undersettings.dataPath, degrades to empty on missing/corrupt), IPC handlers, and frontend api wrappers.localStorage-backed implementation inweb-girder/api/dataset.service.ts, wired intoprovideApi.Test plan
vitest run platform/desktop/backend/native/globalStyles.spec.ts→ 6 passed (round-trip, missing dir, corrupt file, normalization).vitest run src/StyleManager.spec.ts→ passed (optional hook is additive).eslinton all changed files → clean.electron-vite build(desktop backend + renderer) andvite build(web) → both succeed.Notes