Compare commits

..
Author SHA1 Message Date
ohif-bot 973631b7e8 chore(version): Update package versions to 3.13.0-beta.111 [skip ci] 2026-07-06 13:38:47 +00:00
Alireza e0f42d4f1d fix(dicom-pdf): enhance PDF loading with authentication support
- move authenticated rendered media loading into the datasource\n- route DICOM video display sets through Cornerstone video viewports\n- add a 3.12 to 3.13 migration note for the removed DICOM-video viewport namespace
2026-07-06 09:35:26 -04:00
ohif-bot 2800f82e3c chore(version): Update package versions to 3.13.0-beta.110 [skip ci] 2026-07-02 13:00:56 +00:00
Joe Boccanfuso 38214f26de fix(wsi): mount WSI/SM viewports via setDisplaySets (#6107) 2026-07-02 08:57:13 -04:00
ohif-bot cb6cdafd24 chore(version): Update package versions to 3.13.0-beta.109 [skip ci] 2026-06-30 13:28:46 +00:00
Alireza aa1ba771e0 fix(test): stabilize DICOM Tag Browser scrollbar screenshot (#6118) 2026-06-30 09:25:37 -04:00
ohif-bot d4153f12b2 chore(version): Update package versions to 3.13.0-beta.108 [skip ci] 2026-06-29 16:58:29 +00:00
Alireza 71c50db9b5 fix(ci): deploy docs with Netlify CLI monorepo filter (#6115) 2026-06-29 12:55:01 -04:00
ohif-bot 4cdcd34a33 chore(version): Update package versions to 3.13.0-beta.107 [skip ci] 2026-06-29 16:42:34 +00:00
Dan Rukas 0dfd321326 feat(ui-next): Adds appearance dialog with theme presets and custom theme support (#6041) 2026-06-29 12:38:46 -04:00
ohif-bot 0fcebe05c6 chore(version): Update package versions to 3.13.0-beta.106 [skip ci] 2026-06-29 16:36:28 +00:00
Dan Rukas ac45a9497f docs(site): add ui-next component documentation and upgrade Docusaurus (#6102) 2026-06-29 12:33:16 -04:00
Dan Rukas 03b180f185 fix(colors): Replace hardcoded colors with theme tokens (#6040) 2026-06-29 12:32:40 -04:00
ohif-bot e1bc625ab8 chore(version): Update package versions to 3.13.0-beta.105 [skip ci] 2026-06-26 12:23:19 +00:00
Joe Boccanfuso 661ecb5b2e fix(hotkeyBindings): consolidate Escape hotkey behavior for contour drawing tools (#6104)
* fix(hotkeyBindings): consolidate Escape hotkey behavior for contour drawing tools

* PR feedback.

* PR feedback.
2026-06-26 08:20:22 -04:00
ohif-bot b7c8b865dd chore(version): Update package versions to 3.13.0-beta.104 [skip ci] 2026-06-24 19:21:51 +00:00
ee165b4d8e Fix: Segmentation Hide All fails when switching from 2D to 3D fourUp (#5995)
* Fix: Segmentation "Hide All" fails when switching from 2D to 3D four-up viewport

* Update based on the review comment on segmentation load in 3d fourup

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix: simplify the conditional logic

* fix: playwright test

* fix: playwright test

* fix: render timeout in test

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Belbin-GK <150322972+Belbin-GK@users.noreply.github.com>
Co-authored-by: Devu Jayalekshmi <devu.jayalekshmi@trenser.com>
Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
2026-06-24 15:18:16 -04:00
242 changed files with 12265 additions and 6940 deletions

No files matched your search

+3 -2
View File
@@ -117,8 +117,9 @@ jobs:
# would otherwise pick up the repo-root netlify.toml (configured for the
# main viewer app) and build the wrong project. --dir is resolved
# relative to the repo root (the netlify.toml base), not the cwd, so it
# must be the full path to the prebuilt docs output.
run: npx netlify-cli deploy --dir=platform/docs/build --prod --no-build
# must be the full path to the prebuilt docs output. --filter selects
# the ohif-docs package so Netlify CLI does not abort on monorepo detection.
run: npx netlify-cli deploy --filter ohif-docs --dir=platform/docs/build --prod --no-build
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-pmap",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "DICOM Parametric Map read workflow",
"author": "OHIF",
"license": "MIT",
@@ -41,8 +41,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@kitware/vtk.js": "35.5.3"
},
"devDependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-rt",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "DICOM RT read workflow",
"author": "OHIF",
"license": "MIT",
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-seg",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "DICOM SEG read workflow",
"author": "OHIF",
"license": "MIT",
@@ -41,8 +41,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@kitware/vtk.js": "35.5.3"
},
"devDependencies": {
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dicom-sr",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension for an SR Cornerstone Viewport",
"author": "OHIF",
"license": "MIT",
@@ -40,9 +40,9 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"classnames": "2.5.1"
},
"devDependencies": {
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone-dynamic-volume",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension for 4D volumes data",
"author": "OHIF",
"license": "MIT",
@@ -45,8 +45,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"classnames": "2.5.1"
},
"devDependencies": {
+9 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-cornerstone",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension for Cornerstone",
"author": "OHIF",
"license": "MIT",
@@ -38,7 +38,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/dicom-image-loader": "5.0.2",
"@cornerstonejs/dicom-image-loader": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-default": "workspace:*",
"@ohif/ui": "workspace:*",
@@ -52,13 +52,13 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/adapters": "5.0.2",
"@cornerstonejs/ai": "5.0.2",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/labelmap-interpolation": "5.0.2",
"@cornerstonejs/metadata": "5.0.2",
"@cornerstonejs/polymorphic-segmentation": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/adapters": "5.1.3",
"@cornerstonejs/ai": "5.1.3",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/labelmap-interpolation": "5.1.3",
"@cornerstonejs/metadata": "5.1.3",
"@cornerstonejs/polymorphic-segmentation": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@icr/polyseg-wasm": "0.4.0",
"@itk-wasm/morphological-contour-interpolation": "1.1.0",
"@kitware/vtk.js": "35.5.3",
@@ -11,6 +11,7 @@ import {
annotation,
Types as ToolTypes,
SplineContourSegmentationTool,
cancelActiveManipulations,
} from '@cornerstonejs/tools';
import {
SegmentInfo,
@@ -306,6 +307,20 @@ function commandsModule({
commandsManager.run('setDisplaySetsForViewports', { viewportsToUpdate: updatedViewports });
},
/**
* Cancels any in-progress annotation manipulation (e.g. drawing a Spline,
* Livewire or PlanarFreehand contour) on the active viewport. Reached on
* Escape via the `cancelActiveOperation` command. `cancelActiveManipulations`
* invokes the `cancel` method of each active/passive tool that has an
* in-progress annotation, so it is a no-op when nothing is being drawn.
*/
cancelMeasurement: () => {
const element = _getActiveViewportEnabledElement()?.viewport?.element;
if (element) {
cancelActiveManipulations(element);
}
},
hydrateSecondaryDisplaySet: async ({ displaySet, viewportId }) => {
if (!displaySet) {
return;
@@ -2028,6 +2043,24 @@ function commandsModule({
rejectPreview: () => {
actions._handlePreviewAction('reject');
},
/**
* Generic Escape handler. A single Escape press should discard whatever the
* user has in progress, but that can be one of two unrelated things: a
* provisional segmentation preview, or an annotation being drawn. Rather
* than bind both `rejectPreview` and `cancelMeasurement` to `esc` (Mousetrap
* keeps only one handler per key, so the second silently shadows the first),
* this command orchestrates both single-purpose commands. Each is a no-op
* when its state is not active, so running both is safe and order-independent.
*/
cancelActiveOperation: () => {
try {
actions.rejectPreview();
} catch (error) {
console.debug('Error rejecting active preview', error);
} finally {
actions.cancelMeasurement();
}
},
clearMarkersForMarkerLabelmap: () => {
const { viewport } = _getActiveViewportEnabledElement();
const toolGroup = cornerstoneTools.ToolGroupManager.getToolGroupForViewport(viewport.id);
@@ -2550,6 +2583,9 @@ function commandsModule({
removeMeasurement: {
commandFn: actions.removeMeasurement,
},
cancelMeasurement: {
commandFn: actions.cancelMeasurement,
},
toggleLockMeasurement: {
commandFn: actions.toggleLockMeasurement,
},
@@ -2798,6 +2834,7 @@ function commandsModule({
toggleSegmentSelect: actions.toggleSegmentSelect,
acceptPreview: actions.acceptPreview,
rejectPreview: actions.rejectPreview,
cancelActiveOperation: actions.cancelActiveOperation,
toggleUseCenterSegmentIndex: actions.toggleUseCenterSegmentIndex,
toggleLabelmapAssist: actions.toggleLabelmapAssist,
interpolateScrollForMarkerLabelmap: actions.interpolateScrollForMarkerLabelmap,
@@ -60,11 +60,11 @@ const DicomUploadProgressItem = memo(
/>
);
case UploadStatus.InProgress:
return <Icons.ByName name="icon-transferring" />;
return <Icons.ByName name="icon-transferring" className="text-highlight" />;
case UploadStatus.Failed:
return <Icons.ByName name="icon-alert-small" />;
return <Icons.ByName name="icon-alert-small" className="text-destructive" />;
case UploadStatus.Cancelled:
return <Icons.ByName name="icon-alert-outline" />;
return <Icons.ByName name="icon-alert-outline" className="text-highlight" />;
default:
return <></>;
}
@@ -18,7 +18,7 @@ function TrackingStatus({ viewportId }: { viewportId: string }) {
<Tooltip>
<TooltipTrigger asChild>
<span>
<Icons.StatusTracking className="h-4 w-4" />
<Icons.StatusTracking className="h-4 w-4 text-highlight" />
</span>
</TooltipTrigger>
<TooltipContent side="bottom">
@@ -531,10 +531,8 @@ const connectMeasurementServiceToTools = ({
}
// Cancel any active tool manipulation (e.g., Spline/Livewire) to avoid leaving the tool
// in a drawing state after deleting a not completed measurement, which can block viewport interactivity.
const element = getActiveViewportEnabledElement(viewportGridService)?.viewport?.element;
if (element) {
cancelActiveManipulations(element);
}
commandsManager.run('cancelMeasurement');
const removedAnnotation = annotation.state.getAnnotation(removedMeasurementId);
removeAnnotation(removedMeasurementId);
// Ensure `removedAnnotation` is available before triggering the memo,
@@ -88,12 +88,17 @@ const segmentationRepresentationModifiedCallback = async (
return;
}
// Ensure the segmentation representation aligns with the target viewport type.
const type: Enums.SegmentationRepresentations =
isVolume3DViewportType(viewport)
? Enums.SegmentationRepresentations.Surface
: ((segmentationRepresentationType as Enums.SegmentationRepresentations) ??
Enums.SegmentationRepresentations.Labelmap);
// Ensure the segmentation representation aligns with the target viewport type
const is3D = isVolume3DViewportType(viewport);
const requestedRepresentation =
segmentationRepresentationType as Enums.SegmentationRepresentations;
const { Surface, Labelmap } = Enums.SegmentationRepresentations;
const type: Enums.SegmentationRepresentations = is3D
? Surface
: requestedRepresentation && requestedRepresentation !== Surface
? requestedRepresentation
: Labelmap;
await segmentationService.addSegmentationRepresentation(targetViewportId, {
segmentationId,
@@ -8,6 +8,7 @@ import {
utilities as csUtils,
cache,
Enums as csEnums,
metaData,
} from '@cornerstonejs/core';
import { utilities as csToolsUtils, Enums as csToolsEnums } from '@cornerstonejs/tools';
@@ -849,10 +850,21 @@ class CornerstoneViewportService extends PubSubService implements IViewportServi
_presentations: Presentations = {}
): Promise<void> {
const [displaySet] = viewportData.data;
// CS3D's "redo viewports" replaced setDataIds with the generic
// setDisplaySets({ displaySetId }) API; the legacy adapters key off
// imageIds[0] as the displaySetId, so do the same here.
await viewport.setDisplaySets({ displaySetId: displaySet.imageIds[0] });
const displaySetId = displaySet.imageIds[0];
// Register the WSI dataset so the viewport can resolve its imageIds +
// webClient by display-set id, then mount via setDisplaySets. The webClient
// was registered under the WADO_WEB_CLIENT module (keyed by imageIds[0]) by
// the SM SOP class handler. CS3D's "redo viewports" reads this same registry
// (genericViewportDisplaySetMetadataProvider) from its WSI data provider;
// without this entry setDisplaySets throws "No registered WSI dataset" and
// the viewport renders gray.
const webClient = metaData.get(csEnums.MetadataModules.WADO_WEB_CLIENT, displaySetId);
csUtils.genericViewportDisplaySetMetadataProvider.add(displaySetId, {
imageIds: displaySet.imageIds,
kind: 'wsi',
options: { webClient },
});
await viewport.setDisplaySets({ displaySetId });
const viewReference = viewportInfo.getViewReference();
if (viewReference) {
viewport.setViewReference(viewReference);
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-default",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Common/default features and functionality for basic image viewing",
"author": "OHIF Core Team",
"license": "MIT",
@@ -152,7 +152,7 @@ function DataSourceConfigurationModalComponent({
>
<div className="text- flex items-center gap-2">
{itemLabelIndex < selectedItems.length ? (
<Icons.ByName name="status-tracked" />
<Icons.ByName name="status-tracked" className="text-highlight" />
) : (
<Icons.ByName name="status-untracked" />
)}
@@ -12,8 +12,7 @@
.dicom-tag-browser-table tr {
padding-left: 10px;
padding-right: 10px;
color: #ffffff;
border-top: 1px solid #ddd;
color: hsl(var(--foreground));
white-space: nowrap;
}
@@ -43,7 +42,6 @@
padding-left: 10px;
padding-right: 10px;
text-align: center;
color: '#20A5D6';
}
.dicom-tag-browser-table th.dicom-tag-browser-table-left {
@@ -18,6 +18,7 @@ import getDirectURL from '../utils/getDirectURL';
import { fixBulkDataURI } from './utils/fixBulkDataURI';
import { HeadersInterface } from '@ohif/core/src/types/RequestHeaders';
import { getGetThumbnailSrc, ThumbnailContext } from './retrieveThumbnail';
import { getRenderedURL } from './retrieveRendered';
const { DicomMetaDictionary, DicomDict } = dcmjs.data;
@@ -108,7 +109,6 @@ export type BulkDataURIConfig = {
relativeResolution?: 'studies' | 'series';
};
/**
* The header options are the options passed into the generateWadoHeader
* command. This takes an extensible set of attributes to allow future enhancements.
@@ -291,6 +291,14 @@ function createDicomWebApi(dicomWebConfig: DicomWebConfig, servicesManager) {
params
);
},
renderedURL: (params, options) => {
return getRenderedURL({
config: dicomWebConfig,
getAuthorizationHeader,
retrieve: implementation.retrieve,
userAuthenticationService,
})(params, options);
},
/**
* Provide direct access to the dicom web client for certain use cases
* where the dicom web client is used by an external library such as the
@@ -0,0 +1,147 @@
import { fetchRenderedURL, getRenderedURL, isTrustedWadoURL } from './retrieveRendered';
describe('retrieveRendered', () => {
const originalFetch = global.fetch;
const originalCreateObjectURL = URL.createObjectURL;
const originalRevokeObjectURL = URL.revokeObjectURL;
beforeEach(() => {
global.fetch = jest.fn();
URL.createObjectURL = jest.fn(() => 'blob:rendered') as jest.Mock;
URL.revokeObjectURL = jest.fn() as jest.Mock;
jest.spyOn(console, 'warn').mockImplementation(() => {});
});
afterEach(() => {
jest.restoreAllMocks();
global.fetch = originalFetch;
URL.createObjectURL = originalCreateObjectURL;
URL.revokeObjectURL = originalRevokeObjectURL;
});
it('returns null when there is no resolved URL', async () => {
const result = await fetchRenderedURL({
url: undefined,
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
});
expect(result).toEqual({ url: null });
expect(global.fetch).not.toHaveBeenCalled();
});
it('returns the direct URL without fetching when there is no authorization header', async () => {
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: {},
});
expect(result).toEqual({ url: 'https://example.com/dicomweb/rendered' });
expect(global.fetch).not.toHaveBeenCalled();
});
it('does not attach auth headers to untrusted absolute URLs', async () => {
const result = await fetchRenderedURL({
url: 'https://untrusted.example.com/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
});
expect(result).toEqual({ url: 'https://untrusted.example.com/rendered' });
expect(global.fetch).not.toHaveBeenCalled();
});
it('fetches trusted URLs with auth and returns a revocable object URL', async () => {
(global.fetch as jest.Mock).mockResolvedValueOnce({
ok: true,
blob: jest.fn().mockResolvedValueOnce(new Blob(['pdf'], { type: 'application/pdf' })),
});
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/studies/1/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
});
expect(global.fetch).toHaveBeenCalledWith(
'https://example.com/dicomweb/studies/1/rendered',
expect.objectContaining({
method: 'GET',
headers: { Authorization: 'Bearer token' },
})
);
expect(result.url).toBe('blob:rendered');
result.revoke?.();
result.revoke?.();
expect(URL.revokeObjectURL).toHaveBeenCalledTimes(1);
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:rendered');
});
it('returns null and triggers unauthenticated handling on 401/403 responses', async () => {
const handleUnauthenticated = jest.fn();
(global.fetch as jest.Mock).mockResolvedValueOnce({
ok: false,
status: 401,
});
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/studies/1/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
userAuthenticationService: { handleUnauthenticated },
});
expect(result).toEqual({ url: null });
expect(handleUnauthenticated).toHaveBeenCalledTimes(1);
});
it('revokes an object URL created after the request was aborted', async () => {
const abortController = new AbortController();
(global.fetch as jest.Mock).mockResolvedValueOnce({
ok: true,
blob: jest.fn().mockImplementationOnce(async () => {
abortController.abort();
return new Blob(['pdf'], { type: 'application/pdf' });
}),
});
const result = await fetchRenderedURL({
url: 'https://example.com/dicomweb/studies/1/rendered',
wadoRoot: 'https://example.com/dicomweb',
headers: { Authorization: 'Bearer token' },
signal: abortController.signal,
});
expect(result).toEqual({ url: null });
expect(URL.revokeObjectURL).toHaveBeenCalledWith('blob:rendered');
});
it('resolves directURL through the datasource retrieve API', async () => {
const renderedURL = getRenderedURL({
config: { wadoRoot: 'https://example.com/dicomweb' },
getAuthorizationHeader: () => ({}),
retrieve: {
directURL: jest.fn().mockResolvedValueOnce('https://example.com/dicomweb/rendered'),
},
});
await expect(renderedURL({ instance: {} })).resolves.toEqual({
url: 'https://example.com/dicomweb/rendered',
});
});
it('trusts URLs that share the configured WADO origin', () => {
expect(
isTrustedWadoURL('/dicomweb/studies/1/rendered', `${window.location.origin}/dicomweb`)
).toBe(true);
expect(
isTrustedWadoURL(
'https://other.example.com/dicomweb/studies/1/rendered',
'https://example.com/dicomweb'
)
).toBe(false);
});
});
@@ -0,0 +1,141 @@
import { HeadersInterface } from '@ohif/core/src/types/RequestHeaders';
type RetrieveApi = {
directURL: (params: unknown) => unknown;
};
type RenderedURLConfig = {
wadoRoot?: string;
};
type UserAuthenticationService = {
handleUnauthenticated?: () => unknown;
};
type GetRenderedURLDeps = {
config: RenderedURLConfig;
getAuthorizationHeader: () => HeadersInterface;
retrieve: RetrieveApi;
userAuthenticationService?: UserAuthenticationService;
};
type RenderedURLOptions = {
signal?: AbortSignal;
};
type FetchRenderedURLOptions = RenderedURLOptions & {
url?: string | null;
wadoRoot?: string;
headers?: HeadersInterface;
userAuthenticationService?: UserAuthenticationService;
};
export type RenderedURLResult = {
url: string | null;
revoke?: () => void;
};
export function getRenderedURL({
config,
getAuthorizationHeader,
retrieve,
userAuthenticationService,
}: GetRenderedURLDeps) {
return async function renderedURL(
params: unknown,
options: RenderedURLOptions = {}
): Promise<RenderedURLResult> {
const resolvedUrl = (await retrieve.directURL(params)) as string | undefined | null;
return fetchRenderedURL({
url: resolvedUrl,
wadoRoot: config.wadoRoot,
headers: getAuthorizationHeader(),
signal: options.signal,
userAuthenticationService,
});
};
}
export async function fetchRenderedURL({
url,
wadoRoot,
headers,
signal,
userAuthenticationService,
}: FetchRenderedURLOptions): Promise<RenderedURLResult> {
if (!url || signal?.aborted) {
return { url: null };
}
if (!headers?.Authorization || !isTrustedWadoURL(url, wadoRoot)) {
return { url };
}
try {
const response = await fetch(url, {
method: 'GET',
headers: headers as Record<string, string>,
signal,
});
if (!response.ok) {
if (response.status === 401 || response.status === 403) {
userAuthenticationService?.handleUnauthenticated?.();
}
console.warn(`rendered media fetch failed with status ${response.status}`);
return { url: null };
}
const blob = await response.blob();
const objectUrl = URL.createObjectURL(blob);
if (signal?.aborted) {
URL.revokeObjectURL(objectUrl);
return { url: null };
}
return {
url: objectUrl,
revoke: createRevokeOnce(objectUrl),
};
} catch (error) {
if ((error as { name?: string })?.name === 'AbortError') {
return { url: null };
}
console.warn('rendered media fetch failed', error);
return { url: null };
}
}
export function isTrustedWadoURL(url: string, wadoRoot?: string): boolean {
if (!wadoRoot) {
return false;
}
try {
const parsedUrl = new URL(url, window.location.href);
const parsedWadoRoot = new URL(wadoRoot, window.location.href);
const isHttpUrl = parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:';
const isHttpWadoRoot =
parsedWadoRoot.protocol === 'http:' || parsedWadoRoot.protocol === 'https:';
return isHttpUrl && isHttpWadoRoot && parsedUrl.origin === parsedWadoRoot.origin;
} catch {
return false;
}
}
function createRevokeOnce(objectUrl: string) {
let revoked = false;
return () => {
if (revoked) {
return;
}
URL.revokeObjectURL(objectUrl);
revoked = true;
};
}
@@ -52,6 +52,7 @@ function createDicomWebProxyApi(dicomWebProxyConfig, servicesManager: AppTypes.S
retrieve: {
getGetThumbnailSrc: (...args) => dicomWebDelegate.retrieve.getGetThumbnailSrc(...args),
directURL: (...args) => dicomWebDelegate.retrieve.directURL(...args),
renderedURL: (...args) => dicomWebDelegate.retrieve.renderedURL(...args),
series: {
metadata: async (...args) => dicomWebDelegate.retrieve.series.metadata(...args),
},
@@ -62,7 +63,8 @@ function createDicomWebProxyApi(dicomWebProxyConfig, servicesManager: AppTypes.S
reject: {
series: (...args) => dicomWebDelegate?.reject?.series?.(...args),
},
deleteStudyMetadataPromise: (...args) => dicomWebDelegate?.deleteStudyMetadataPromise?.(...args),
deleteStudyMetadataPromise: (...args) =>
dicomWebDelegate?.deleteStudyMetadataPromise?.(...args),
getImageIdsForDisplaySet: (...args) => dicomWebDelegate?.getImageIdsForDisplaySet?.(...args),
getImageIdsForInstance: (...args) => dicomWebDelegate?.getImageIdsForInstance?.(...args),
getConfig: (...args) =>
@@ -242,6 +242,24 @@ function createMergeDataSourceApi(
defaultDataSourceName,
extensionManager,
}),
renderedURL: (...args: unknown[]) => {
const [dataSource] = extensionManager.getDataSources(defaultDataSourceName);
const renderedURL = get(dataSource, 'retrieve.renderedURL');
if (renderedURL) {
return renderedURL.apply(dataSource, args);
}
const directURL = get(dataSource, 'retrieve.directURL');
if (!directURL) {
return Promise.resolve({ url: null });
}
return Promise.resolve(directURL.apply(dataSource, [args[0]])).then(url => ({
url: (url as string | undefined | null) || null,
}));
},
series: {
metadata: (...args: unknown[]) =>
callForAllDataSourcesAsync({
@@ -43,6 +43,10 @@ function ViewerHeader({ appConfig }: withAppTypes<{ appConfig: AppTypes.Config }
'ohif.aboutModal'
) as Types.MenuComponentCustomization;
const AppearanceModal = customizationService.getCustomization(
'ohif.appearanceModal'
) as Types.MenuComponentCustomization;
const UserPreferencesModal = customizationService.getCustomization(
'ohif.userPreferencesModal'
) as Types.MenuComponentCustomization;
@@ -71,6 +75,19 @@ function ViewerHeader({ appConfig }: withAppTypes<{ appConfig: AppTypes.Config }
},
];
if (AppearanceModal) {
menuOptions.splice(1, 0, {
title: AppearanceModal.menuTitle ?? t('Header:Appearance'),
icon: 'ColorChange',
onClick: () =>
show({
content: AppearanceModal,
title: AppearanceModal.title ?? t('AppearanceModal:Appearance'),
containerClassName: AppearanceModal.containerClassName ?? 'max-w-md',
}),
});
}
if (appConfig.oidc) {
menuOptions.push({
title: t('Header:Logout'),
@@ -0,0 +1,143 @@
import React from 'react';
import {
AppearanceModal,
Select,
SelectTrigger,
SelectValue,
SelectContent,
SelectItem,
Button,
useActiveTheme,
themePresets,
} from '@ohif/ui-next';
import { useTranslation } from 'react-i18next';
function AppearanceModalDefault() {
const { activeTheme, setActiveTheme, customCss, applyCustomTheme, clearCustomTheme } =
useActiveTheme();
const { t } = useTranslation('AppearanceModal');
const [draftCss, setDraftCss] = React.useState(() => customCss);
const [isCustomOpen, setIsCustomOpen] = React.useState(() => activeTheme === 'custom');
const [parseFailed, setParseFailed] = React.useState(false);
const handleToggleCustom = () => {
setIsCustomOpen(!isCustomOpen);
};
const handleSave = () => {
setParseFailed(!applyCustomTheme(draftCss));
};
const handleClear = () => {
clearCustomTheme();
setDraftCss('');
setParseFailed(false);
setIsCustomOpen(false);
};
const handlePresetChange = (value: string) => {
if (value === 'custom') {
// Selecting "Custom" restores the saved custom theme; the draft is only
// committed through the explicit Apply button.
setIsCustomOpen(true);
if (customCss) {
applyCustomTheme(customCss);
}
} else {
setIsCustomOpen(false);
setActiveTheme(value);
}
};
const handleTextChange = (e: React.ChangeEvent<HTMLTextAreaElement>) => {
setDraftCss(e.target.value);
setParseFailed(false);
};
return (
<AppearanceModal>
<AppearanceModal.Body>
<div className="grid grid-cols-[auto_1fr] items-center gap-x-6 gap-y-4">
<AppearanceModal.SectionLabel>{t('Theme')}</AppearanceModal.SectionLabel>
<div>
<Select
value={activeTheme}
onValueChange={handlePresetChange}
>
<SelectTrigger
className="w-[200px]"
aria-label={t('Theme')}
>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="default">{t('Default Theme')}</SelectItem>
{themePresets.map(preset => (
<SelectItem
key={preset.name}
value={preset.name}
>
{preset.label}
</SelectItem>
))}
{(customCss || draftCss) && <SelectItem value="custom">{t('Custom')}</SelectItem>}
</SelectContent>
</Select>
</div>
<div className="col-start-2">
<Button
variant="ghost"
size="sm"
onClick={handleToggleCustom}
>
{isCustomOpen ? t('Hide') : t('Custom Theme')}
</Button>
</div>
</div>
{isCustomOpen && (
<div className="mt-4 flex flex-col space-y-2">
<textarea
value={draftCss}
onChange={handleTextChange}
placeholder={t('Paste your custom theme color tokens here')}
aria-label={t('Paste your custom theme color tokens here')}
rows={8}
className="bg-muted text-foreground border-input placeholder:text-muted-foreground focus:ring-ring rounded-md border px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-inset"
/>
{parseFailed && (
<span
className="text-destructive text-sm"
role="alert"
>
{t('No valid theme tokens found')}
</span>
)}
<div className="flex space-x-2">
<Button
variant="default"
size="sm"
onClick={handleSave}
>
{t('Apply')}
</Button>
<Button
variant="ghost"
size="sm"
onClick={handleClear}
>
{t('Clear')}
</Button>
</div>
</div>
)}
</AppearanceModal.Body>
</AppearanceModal>
);
}
export default {
'ohif.appearanceModal': AppearanceModalDefault,
};
@@ -18,6 +18,7 @@ import progressLoadingBarCustomization from './customizations/progressLoadingBar
import labellingFlowCustomization from './customizations/labellingFlowCustomization';
import viewportNotificationCustomization from './customizations/notificationCustomization';
import aboutModalCustomization from './customizations/aboutModalCustomization';
import appearanceModalCustomization from './customizations/appearanceModalCustomization';
import userPreferencesCustomization from './customizations/userPreferencesCustomization';
import reportDialogCustomization from './customizations/reportDialogCustomization';
import hotkeyBindingsCustomization from './customizations/hotkeyBindingsCustomization';
@@ -39,6 +40,10 @@ export default function getCustomizationModule({ servicesManager, extensionManag
name: 'helloPage',
value: helloPageCustomization,
},
{
name: 'theme',
value: appearanceModalCustomization,
},
{
name: 'datasources',
value: datasourcesCustomization,
+12
View File
@@ -1,5 +1,6 @@
import { DicomMetadataStore, classes } from '@ohif/core';
import { calculateSUVScalingFactors } from '@cornerstonejs/calculate-suv';
import { ActiveThemeProvider } from '@ohif/ui-next';
import getPTImageIdInstanceMetadata from './getPTImageIdInstanceMetadata';
import { registerHangingProtocolAttributes } from './hangingprotocols';
@@ -16,7 +17,18 @@ export default function init({
servicesManager,
commandsManager,
hotkeysManager,
serviceProvidersManager,
appConfig,
}: withAppTypes): void {
const hasThemeModule =
Array.isArray(appConfig.customizationService) &&
appConfig.customizationService.some(
ref => typeof ref === 'string' && ref.includes('customizationModule.theme')
);
if (hasThemeModule) {
serviceProvidersManager.registerProvider('activeTheme', ActiveThemeProvider);
}
const { toolbarService, cineService, viewportGridService } = servicesManager.services;
toolbarService.registerEventForToolbarUpdate(cineService, [
@@ -1,3 +1,4 @@
.chrome-picker {
background: #090c29 !important;
background: transparent !important;
box-shadow: none !important;
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-microscopy",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension for DICOM microscopy",
"author": "Bill Wallace, md-prog",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-pdf",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension for PDF display",
"author": "OHIF",
"license": "MIT",
@@ -14,12 +14,17 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
const { Modality, SOPInstanceUID } = instance;
const { SeriesDescription = 'PDF', MIMETypeOfEncapsulatedDocument } = instance;
const { SeriesNumber, SeriesDate, SeriesInstanceUID, StudyInstanceUID, SOPClassUID } = instance;
const renderedUrl = dataSource.retrieve.directURL({
const renderedUrlParams = {
instance,
tag: 'EncapsulatedDocument',
defaultType: MIMETypeOfEncapsulatedDocument || 'application/pdf',
singlepart: 'pdf',
});
};
const renderedUrl = dataSource.retrieve.directURL(renderedUrlParams);
const getRenderedUrl = dataSource.retrieve.renderedURL
? options =>
dataSource.retrieve.renderedURL({ ...renderedUrlParams, url: renderedUrl }, options)
: undefined;
const displaySet = {
//plugin: id,
@@ -36,6 +41,7 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
referencedImages: null,
measurements: null,
renderedUrl: renderedUrl,
getRenderedUrl,
instances: [instance],
thumbnailSrc: null,
isDerivedDisplaySet: true,
+2 -8
View File
@@ -28,15 +28,9 @@ const dicomPDFExtension = {
* @param {object} [configuration={}]
* @param {object|array} [configuration.csToolsConfig] - Passed directly to `initCornerstoneTools`
*/
getViewportModule({ servicesManager, extensionManager }) {
getViewportModule() {
const ExtendedOHIFCornerstonePdfViewport = props => {
return (
<OHIFCornerstonePdfViewport
servicesManager={servicesManager}
extensionManager={extensionManager}
{...props}
/>
);
return <OHIFCornerstonePdfViewport {...props} />;
};
return [{ name: 'dicom-pdf', component: ExtendedOHIFCornerstonePdfViewport }];
@@ -33,14 +33,43 @@ function OHIFCornerstonePdfViewport({ displaySets, viewportId = 'pdf-viewport' }
}
const { renderedUrl } = displaySets[0];
const { getRenderedUrl } = displaySets[0];
useEffect(() => {
let isCancelled = false;
let revokeUrl;
const abortController = new AbortController();
const load = async () => {
setUrl(await renderedUrl);
try {
const result = getRenderedUrl
? await getRenderedUrl({ signal: abortController.signal })
: { url: await renderedUrl };
if (isCancelled) {
result?.revoke?.();
return;
}
revokeUrl = result?.revoke;
setUrl(result?.url || null);
} catch (error) {
console.warn('Failed to load PDF', error);
if (!isCancelled) {
setUrl(null);
}
return;
}
};
load();
}, [renderedUrl]);
return () => {
isCancelled = true;
abortController.abort();
revokeUrl?.();
};
}, [renderedUrl, getRenderedUrl]);
return (
<div
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-dicom-video",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension for video display",
"author": "OHIF",
"license": "MIT",
@@ -57,12 +57,16 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
const { Modality, SOPInstanceUID, SeriesDescription = 'VIDEO', imageId } = instance;
const { SeriesNumber, SeriesDate, SeriesInstanceUID, StudyInstanceUID, NumberOfFrames, url } =
instance;
const videoUrl = dataSource.retrieve.directURL({
const videoUrlParams = {
instance,
singlepart: 'video',
tag: 'PixelData',
url,
});
};
const videoUrl = dataSource.retrieve.directURL(videoUrlParams);
const getVideoUrl = dataSource.retrieve.renderedURL
? options => dataSource.retrieve.renderedURL({ ...videoUrlParams, url: videoUrl }, options)
: undefined;
const displaySet = {
//plugin: id,
Modality,
@@ -76,6 +80,8 @@ const _getDisplaySetsFromSeries = (instances, servicesManager, extensionManager)
SOPClassHandlerId,
referencedImages: null,
measurements: null,
videoUrl,
getVideoUrl,
viewportType: csEnums.ViewportType.VIDEO,
instances: [instance],
getThumbnailSrc: dataSource.retrieve.getGetThumbnailSrc?.(instance),
-44
View File
@@ -1,19 +1,6 @@
import React from 'react';
import getSopClassHandlerModule from './getSopClassHandlerModule';
import { id } from './id';
const Component = React.lazy(() => {
return import(/* webpackPrefetch: true */ './viewports/OHIFCornerstoneVideoViewport');
});
const OHIFCornerstoneVideoViewport = props => {
return (
<React.Suspense fallback={<div>Loading...</div>}>
<Component {...props} />
</React.Suspense>
);
};
/**
*
*/
@@ -23,38 +10,7 @@ const dicomVideoExtension = {
*/
id,
/**
*
*
* @param {object} [configuration={}]
* @param {object|array} [configuration.csToolsConfig] - Passed directly to `initCornerstoneTools`
*/
getViewportModule({ servicesManager, extensionManager }) {
const ExtendedOHIFCornerstoneVideoViewport = props => {
return (
<OHIFCornerstoneVideoViewport
servicesManager={servicesManager}
extensionManager={extensionManager}
{...props}
/>
);
};
return [{ name: 'dicom-video', component: ExtendedOHIFCornerstoneVideoViewport }];
},
getSopClassHandlerModule,
};
function _getToolAlias(toolName) {
let toolAlias = toolName;
switch (toolName) {
case 'EllipticalRoi':
toolAlias = 'SREllipticalRoi';
break;
}
return toolAlias;
}
export default dicomVideoExtension;
@@ -1,55 +0,0 @@
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
function OHIFCornerstoneVideoViewport({ displaySets }) {
if (displaySets && displaySets.length > 1) {
throw new Error(
'OHIFCornerstoneVideoViewport: only one display set is supported for dicom video right now'
);
}
const { videoUrl } = displaySets[0];
const mimeType = 'video/mp4';
const [url, setUrl] = useState(null);
useEffect(() => {
const load = async () => {
setUrl(await videoUrl);
};
load();
}, [videoUrl]);
// Need to copies of the source to fix a firefox bug
return (
<div className="bg-primary-black h-full w-full">
<video
src={url}
controls
controlsList="nodownload"
preload="auto"
className="h-full w-full"
crossOrigin="anonymous"
>
<source
src={url}
type={mimeType}
/>
<source
src={url}
type={mimeType}
/>
Video src/type not supported:{' '}
<a href={url}>
{url} of type {mimeType}
</a>
</video>
</div>
);
}
OHIFCornerstoneVideoViewport.propTypes = {
displaySets: PropTypes.arrayOf(PropTypes.object).isRequired,
};
export default OHIFCornerstoneVideoViewport;
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-measurement-tracking",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Tracking features and functionality for basic image viewing",
"author": "OHIF Core Team",
"license": "MIT",
@@ -27,8 +27,8 @@
"start": "pnpm run dev"
},
"peerDependencies": {
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-cornerstone-dicom-sr": "workspace:*",
"@ohif/extension-default": "workspace:*",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-test",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension used inside e2e testing",
"author": "OHIF",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-tmtv",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF extension for Total Metabolic Tumor Volume",
"author": "OHIF",
"license": "MIT",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/extension-ultrasound-pleura-bline",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "",
"author": "Rodrigo Basilio",
"license": "MIT",
@@ -36,8 +36,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-cornerstone": "workspace:*",
"@ohif/extension-default": "workspace:*",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-basic-dev-mode",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Basic OHIF Viewer Using Cornerstone",
"author": "OHIF",
"license": "MIT",
+1 -6
View File
@@ -26,7 +26,6 @@ const dicomsr = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
@@ -141,11 +140,7 @@ function modeFactory({ modeConfiguration }) {
viewports: [
{
namespace: cs3d.viewport,
displaySetsToDisplay: [ohif.sopClassHandler],
},
{
namespace: dicomvideo.viewport,
displaySetsToDisplay: [dicomvideo.sopClassHandler],
displaySetsToDisplay: [ohif.sopClassHandler, dicomvideo.sopClassHandler],
},
{
namespace: dicompdf.viewport,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-test",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Basic mode for testing",
"author": "OHIF",
"license": "MIT",
-5
View File
@@ -33,7 +33,6 @@ const dicomsr = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
@@ -254,10 +253,6 @@ function modeFactory() {
namespace: dicomsr.viewport,
displaySetsToDisplay: [dicomsr.sopClassHandler, dicomsr.sopClassHandler3D],
},
{
namespace: dicomvideo.viewport,
displaySetsToDisplay: [dicomvideo.sopClassHandler],
},
{
namespace: dicompdf.viewport,
displaySetsToDisplay: [dicompdf.sopClassHandler],
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-basic",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "A basic mode used to build other modes on top of",
"author": "OHIF Contributors",
"license": "MIT",
-1
View File
@@ -44,7 +44,6 @@ export const dicomsr = {
export const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
export const dicomecg = {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-longitudinal",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Longitudinal Workflow",
"author": "OHIF",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-microscopy",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF mode for DICOM microscopy",
"author": "OHIF",
"license": "MIT",
+1 -2
View File
@@ -17,7 +17,6 @@ export const cornerstone = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
@@ -107,7 +106,7 @@ function modeFactory({ modeConfiguration }) {
],
},
{
namespace: dicomvideo.viewport,
namespace: cornerstone.viewport,
displaySetsToDisplay: [dicomvideo.sopClassHandler],
},
{
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-preclinical-4d",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "4D Workflow",
"author": "OHIF",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-segmentation",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "OHIF segmentation mode which enables labelmap segmentation read/edit/export",
"author": "@ohif",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-tmtv",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Total Metabolic Tumor Volume Workflow",
"author": "OHIF",
"license": "MIT",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/mode-ultrasound-pleura-bline",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Allows users to annotate ultrasound images with pleura B-line annotations.",
"author": "OHIF",
"license": "MIT",
@@ -29,8 +29,8 @@
},
"dependencies": {
"@babel/runtime": "7.29.7",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/tools": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/tools": "5.1.3",
"@ohif/core": "workspace:*",
"@ohif/extension-cornerstone-dicom-sr": "workspace:*",
"@ohif/extension-ultrasound-pleura-bline": "workspace:*",
-1
View File
@@ -32,7 +32,6 @@ const dicomsr = {
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
const dicompdf = {
+1 -1
View File
@@ -124,5 +124,5 @@
"git add"
]
},
"version": "3.13.0-beta.103"
"version": "3.13.0-beta.111"
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/app",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"productVersion": "3.4.0",
"description": "OHIF Viewer",
"author": "OHIF Contributors",
@@ -51,7 +51,7 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/dicom-image-loader": "5.0.2",
"@cornerstonejs/dicom-image-loader": "5.1.3",
"@emotion/serialize": "1.3.3",
"@ohif/core": "workspace:*",
"@ohif/i18n": "workspace:*",
+3
View File
@@ -2,6 +2,9 @@
window.config = {
routerBasename: null,
customizationService: [
'@ohif/extension-default.customizationModule.theme',
],
extensions: [],
modes: [],
showStudyList: true,
@@ -15,7 +15,7 @@ const NotFound = ({
return (
<div className="absolute flex h-full w-full items-center justify-center bg-background">
<div className="flex flex-col">
<div className="bg-background flex items-center justify-center rounded-t-2xl p-6">
<div className="bg-background flex items-center justify-center rounded-t-2xl p-6 text-primary">
<Icons.IllustrationNotFound />
</div>
<div className="bg-input h-px" />
@@ -30,7 +30,7 @@ export function defaultSettingsMenuItems({
const items: SettingsMenuItem[] = [
{
id: 'about',
label: 'About OHIF Viewer',
label: t('Header:About'),
onClick: () => {
const AboutModal = customizationService.getCustomization('ohif.aboutModal');
show({
@@ -42,7 +42,7 @@ export function defaultSettingsMenuItems({
},
{
id: 'userPreferences',
label: 'User Preferences',
label: t('Header:Preferences'),
onClick: () => {
const UserPreferencesModal = customizationService.getCustomization(
'ohif.userPreferencesModal'
@@ -57,6 +57,21 @@ export function defaultSettingsMenuItems({
},
];
const AppearanceModal = customizationService.getCustomization('ohif.appearanceModal');
if (AppearanceModal) {
items.splice(1, 0, {
id: 'appearance',
label: AppearanceModal.menuTitle ?? t('Header:Appearance'),
onClick: () => {
show({
content: AppearanceModal,
title: AppearanceModal.title ?? t('AppearanceModal:Appearance'),
containerClassName: AppearanceModal.containerClassName ?? 'max-w-md',
});
},
});
}
if (appConfig.oidc) {
items.push({
id: 'logout',
@@ -107,7 +122,7 @@ export function StudyListSettingsPopover() {
>
<Icons.SettingsStudyList
aria-hidden="true"
className="h-4 w-4"
className="text-primary h-4 w-4"
/>
</Button>
</StudyList.SettingsPopover.Trigger>
@@ -107,7 +107,7 @@ export default function WorkList({
isLoading={showStudyListLoading}
loadingComponent={
LoadingIndicatorProgress ? (
<LoadingIndicatorProgress className="!relative bg-black" />
<LoadingIndicatorProgress className="bg-background !relative" />
) : (
<div className="h-8 w-8" />
)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/cli",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "A CLI to bootstrap new OHIF extension or mode",
"type": "module",
"main": "src/index.js",
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@ohif/core",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"description": "Generic business logic for web-based medical imaging applications",
"author": "OHIF Core Team",
"license": "MIT",
@@ -35,9 +35,9 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "1.2.2",
"@cornerstonejs/codec-openjpeg": "1.3.0",
"@cornerstonejs/codec-openjph": "2.4.7",
"@cornerstonejs/core": "5.0.2",
"@cornerstonejs/dicom-image-loader": "5.0.2",
"@cornerstonejs/metadata": "5.0.2",
"@cornerstonejs/core": "5.1.3",
"@cornerstonejs/dicom-image-loader": "5.1.3",
"@cornerstonejs/metadata": "5.1.3",
"@ohif/ui": "workspace:*",
"cornerstone-math": "0.1.10",
"dicom-parser": "1.8.21"
+2 -7
View File
@@ -134,8 +134,8 @@ const bindings = [
isEditable: true,
},
{
commandName: 'cancelMeasurement',
label: 'Cancel Measurement',
commandName: 'cancelActiveOperation',
label: 'Cancel',
keys: ['esc'],
},
{
@@ -172,11 +172,6 @@ const bindings = [
label: 'Accept Preview',
keys: ['enter'],
},
{
commandName: 'rejectPreview',
label: 'Reject Preview',
keys: ['esc'],
},
{
commandName: 'undo',
label: 'Undo',
@@ -118,6 +118,7 @@ window.config = ({ servicesManager } = {}) => {
Here are a list of some options available:
- `customizationService`: An array of customization module references and inline overrides applied at the global scope. This is how deployers enable optional features like the [Appearance & Theming](./ui.md) system and configure UI components without modifying core code. See [Customization Service](../platform/services/customization-service/customizationService.md) for the full syntax reference.
- `disableEditing`: If true, it disables editing in OHIF, hiding edit buttons in segmentation
panel and locking already stored measurements.
- `maxNumberOfWebWorkers`: The maximum number of web workers to use for
+161
View File
@@ -0,0 +1,161 @@
---
sidebar_position: 5
sidebar_label: UI & Appearance
title: UI & Appearance
summary: Overview of OHIF's UI system — the component library, theming and appearance customization, iconography, and the services that drive modals, dialogs, notifications, and viewport layout.
---
# UI & Appearance
OHIF's user interface is built on **ui-next**, a component library purpose-built
for medical imaging workflows. It provides a consistent set of React components,
a token-based theming system, a curated icon set, and a collection of UI services
that manage runtime behavior like modals, notifications, and viewport layout.
This page gives a high-level map of how these pieces fit together and where to
find detailed documentation for each.
## Component Library
The [component library](/components) is the foundation of every panel, toolbar, dialog, and
control in the viewer. Components are organized into three tiers:
- **Simple components** — atomic building blocks like Button, Checkbox, Input,
Label, Slider, and Switch. These are styled with the design system's tokens and
are the smallest interactive units.
- **Compound components** — composed from simple components to handle more
complex interactions: Select, Dialog, DropdownMenu, Tabs, Table, Popover,
Tooltip, Toast, and others. These manage their own state (open/close, selection,
focus) via headless patterns.
- **OHIF-specific components** — built for medical imaging workflows and not
found in general-purpose libraries: AllInOneMenu, CinePlayer, DataRow,
DataTable, Numeric, PanelSection, SmartScrollbar, ToolButton, and
ToolButtonList. These integrate directly with OHIF's services and extension
system.
Every component renders live in the interactive
[Components](/components) section of this documentation site, where you
can see props, variants, and copy usage examples.
## Appearance Dialog
The Appearance dialog is an optional UI that lets end users switch presets,
apply custom CSS overrides, and share themes via URL. It is not enabled by
default, but deployers can
[opt in via configuration](../platform/services/customization-service/appearance-theming.md#enabling-the-theme-module).
See [Appearance & Theming](../platform/services/customization-service/appearance-theming.md)
for the full setup and developer guide.
## Colors & Theming
OHIF uses a **token-based color system** built on CSS custom properties with HSL
values. The base theme (dark mode) is defined in `:root` via Tailwind CSS, and
theme presets override specific tokens by applying a CSS class to `document.body`.
The theming system covers:
- **[Design tokens](/colors-and-theming#color-tokens-and-roles)** — a set of semantic color variables (`--background`,
`--primary`, `--card`, `--border`, etc.) that every component references. Tokens
are defined as HSL triplets and consumed via Tailwind's `hsl(var(...))` pattern.
- **Theme presets** — six built-in themes (three tonal, three neutral) that shift
the entire interface's color palette. Presets are defined as JSON files and
applied via CSS classes. Also see:
[Creating Themes](/colors-and-theming#creating-themes) and
[Adding a Theme Preset](../platform/services/customization-service/appearance-theming.md#adding-a-theme-preset).
- **Accessibility** — foreground tokens are paired with every surface token to
maintain contrast ratios across themes. When adding custom themes,
[test colors to match accessibility standards](/colors-and-theming#accessibility).
Explore the live token swatches and theme picker in the interactive
[Colors & Theming](/colors-and-theming) page, and see
[Appearance & Theming](../platform/services/customization-service/appearance-theming.md)
for the full configuration and developer guide.
## Iconography
OHIF ships a curated set of icons designed specifically for medical imaging interfaces.
Icons are SVG-based, registered via `addIcon()`, and rendered through the `Icons`
component. They follow the same token system as the rest of the UI, so icon colors
respond to the active theme.
Browse the full set with search and click-to-copy in the
[Iconography](/components/icons) page.
## White Labeling
OHIF supports replacing the header logo with custom branding via the
`whiteLabeling` configuration key. This lets you rebrand the viewer without
modifying source code.
Add a `whiteLabeling` entry to your configuration file with a
`createLogoComponentFn` that returns a React element:
```js
window.config = {
/** .. **/
whiteLabeling: {
createLogoComponentFn: function(React) {
return React.createElement(
'a',
{
target: '_self',
rel: 'noopener noreferrer',
className: 'text-purple-600 line-through',
href: '/',
},
React.createElement('img', {
src: './customLogo.svg',
})
);
},
},
/** .. **/
};
```
![custom-logo](../assets/img/custom-logo.png)
You can use Tailwind CSS utility classes in the `className` property to style
your custom logo component.
## UI Services
While the component library handles what gets rendered, **UI services** handle
the runtime behavior: opening modals, showing notifications, managing viewport
layout, and coordinating dialogs. These services use a pub/sub architecture and
are accessed through the `servicesManager`:
| Service | What it manages |
|---------|----------------|
| [Modal Service](../platform/services/ui/ui-modal-service.md) | Full-screen and contained modals (including the Appearance dialog) |
| [Dialog Service](../platform/services/ui/ui-dialog-service.md) | Lightweight dialogs with form inputs and confirmations |
| [Notification Service](../platform/services/ui/ui-notification-service.md) | Toast notifications (success, warning, error, info) |
| [Viewport Grid Service](../platform/services/ui/viewport-grid-service.md) | Viewport layout, grid arrangement, and active viewport tracking |
| [Viewport Dialog Service](../platform/services/ui/ui-viewport-dialog-service.md) | Dialogs anchored to specific viewports |
| [Viewport Action Menu](../platform/services/ui/viewport-action-menu.md) | Context menus and action buttons on viewport corners |
| [Cine Service](../platform/services/ui/cine-service.md) | Cine playback controls and frame rate |
UI services are documented in the [Services > UI](../platform/services/ui/index.md)
section.
## Customization Service
The [Customization Service](../platform/services/customization-service/customizationService.md)
is the mechanism that ties everything together. It allows deployers and
extension authors to override, extend, or replace UI components and behaviors
without modifying core code. Customizations can be scoped to a specific mode, set
globally via configuration, or provided as defaults by extensions.
The Appearance dialog itself is delivered as a customization module. Deployers
enable it by adding a single reference to their config's `customizationService`
array. This pattern means that any part of the UI that supports customization
can be configured the same way.
See the full customization guide at
[Customization Service](../platform/services/customization-service/customizationService.md),
including the syntax reference for `$set`, `$push`, `$merge`, `$filter`, and
other operations.
+1 -1
View File
@@ -1,5 +1,5 @@
---
sidebar_position: 3
sidebar_position: 4
sidebar_label: URL
title: URL Parameters
summary: Reference for OHIF Viewer URL parameters that control WorkList filtering, study/series loading, and viewer behavior, including parameters for filtering by patient name, modality, data sources, specifying initial series/instances, and selecting hanging protocols.
@@ -6,10 +6,9 @@ title: 3.10 to 3.11 Migration Guide
---
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
# 3.10 to 3.11 Migration Guide
Here you can find the migration guides for upgrading from OHIF version 3.10 to version 3.11.
<DocCardList items={useCurrentSidebarCategory().items.filter(item => item.docId !== 'migration-guide/3p10-to-3p11/index')}/>
<DocCardList />
@@ -0,0 +1,99 @@
---
sidebar_position: 7
sidebar_label: Color System
title: Color System Migration
summary: 3.13 continues the migration from legacy color classes to the ui-next semantic color system. This guide maps legacy color names to their ui-next equivalents and shows common text, background, and border replacements.
---
# Color System Migration
This guide covers migrating from legacy color classes to the new ui-next color system.
## Current State (3.13+)
The OHIF Viewer is now built entirely with ui-next components, which use the [new color system](/colors-and-theming). The legacy components in `platform/ui` remain on the old color system. For reference, the table below maps the legacy colors to their ui-next equivalents.
## Color Mapping Reference
| Legacy Color | Updated color (ui-next) |
| ----------------- | ----------------------- |
| `bkg-low` | `background` |
| `common-bright` | `foreground` (various) |
| `primary-light` | `highlight` |
| `inputfield-main` | `input` |
| `secondary-light` | `input` |
| `primary-dark` | `muted` |
| `bkg-med` | `muted` |
| `aqua-pale` | `muted-foreground` |
| `secondary-dark` | `popover` |
| `primary-active` | `primary` |
| `actions-primary` | `primary` |
| `secondary-main` | |
| `primary-main` | |
| `common-dark` | |
| `customblue` | |
> **Note:** The legacy variables left blank in the table above (`secondary-main`, `primary-main`, `common-dark`, and `customblue`) have no direct ui-next equivalent. If your code uses any of these, replace them case by case, choosing the semantic token that best fits how the color is used in each component.
## Generic Color Migrations
Avoid using generic color values. Use semantic colors instead:
| Generic Color | Semantic Replacement |
| ---------------------------- | ----------------------- |
| `white` | `foreground` |
| `blue-*` (e.g., `blue-500`) | `primary` or `highlight`|
| `gray-*` (e.g., `gray-800`) | `muted` or `popover` |
| `red-*` | `destructive` |
> **Note:** `black` is still used in certain cases to replace default browser backgrounds and to match imaging backgrounds.
## Common Migrations
### Text Colors
```diff
- text-white
+ text-foreground
- text-primary-light
+ text-highlight
- text-primary-active
+ text-primary
- text-secondary-light
+ text-muted-foreground
```
### Background Colors
```diff
- bg-primary-dark
+ bg-muted
- bg-secondary-dark
+ bg-popover
- bg-black
+ bg-background
```
### Border Colors
```diff
- border-secondary-light
+ border-input
- border-primary-light
+ border-highlight
- border-primary-dark
+ border-muted
```
## Important Notes
- Legacy colors without a mapping (empty cells) should be evaluated on a case-by-case basis
- The new color system uses CSS variables, enabling future theme support
- When migrating, test components visually to ensure proper contrast and accessibility
@@ -0,0 +1,74 @@
---
sidebar_position: 8
sidebar_label: DICOM video viewport
title: DICOM video viewport migration
---
# DICOM video viewport migration
The `@ohif/extension-dicom-video` extension no longer provides its own viewport module in 3.13. DICOM video rendering is handled by the Cornerstone viewport, which supports Cornerstone3D video viewports directly.
The DICOM video SOP class handler remains available and should still be used to identify and build video display sets:
```ts
'@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video'
```
## What changed
The following viewport namespace has been removed:
```ts
'@ohif/extension-dicom-video.viewportModule.dicom-video'
```
Use the Cornerstone viewport namespace instead:
```ts
'@ohif/extension-cornerstone.viewportModule.cornerstone'
```
## Migration
If your mode has a dedicated DICOM video viewport entry, replace it with the Cornerstone viewport or add the video SOP class handler to an existing Cornerstone viewport entry.
**Before (3.12):**
```ts
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
viewport: '@ohif/extension-dicom-video.viewportModule.dicom-video',
};
viewports: [
{
namespace: '@ohif/extension-cornerstone.viewportModule.cornerstone',
displaySetsToDisplay: [ohif.sopClassHandler],
},
{
namespace: dicomvideo.viewport,
displaySetsToDisplay: [dicomvideo.sopClassHandler],
},
];
```
**After (3.13):**
```ts
const dicomvideo = {
sopClassHandler: '@ohif/extension-dicom-video.sopClassHandlerModule.dicom-video',
};
viewports: [
{
namespace: '@ohif/extension-cornerstone.viewportModule.cornerstone',
displaySetsToDisplay: [ohif.sopClassHandler, dicomvideo.sopClassHandler],
},
];
```
If your mode uses a custom viewport that wraps `OHIFCornerstoneViewport` (for example, a tracked Cornerstone viewport), route DICOM video display sets through that wrapper instead of the removed DICOM video viewport namespace.
## Why
Keeping video rendering in the Cornerstone viewport avoids a separate custom React video viewport path and keeps video behavior aligned with Cornerstone3D viewport services, tools, annotations, and presentation state handling.
@@ -0,0 +1,89 @@
---
sidebar_position: 7
sidebar_label: Escape / cancelActiveOperation hotkey
title: Escape hotkey consolidation
---
# Escape hotkey – single `cancelActiveOperation` command
The default `Escape` hotkey behavior has been consolidated. Previously the
`esc` key was bound to **two** separate commands in the default hotkey
bindings — `cancelMeasurement` and `rejectPreview`. Because the underlying
hotkey library (Mousetrap) keeps only **one** handler per key, the
later-registered binding (`rejectPreview`) silently shadowed the other, so
`cancelMeasurement` never ran and an in-progress Spline/Livewire/PlanarFreehand
contour (or any annotation being drawn) could not be cancelled with `Escape`.
`Escape` is now bound to a single generic command, **`cancelActiveOperation`**,
which orchestrates the two single-purpose commands. Each is a no-op when its
state is not active, so one `Escape` press consistently:
- rejects a provisional segmentation **preview** (via `rejectPreview`), and
- cancels an **in-progress annotation** being drawn (via `cancelMeasurement`).
## Change
| 3.12 (old) | 3.13 (new) |
|----------------------------------------------|-----------------------------------------|
| `esc` → `cancelMeasurement` **and** `esc` → `rejectPreview` (the latter shadowed the former) | `esc` → `cancelActiveOperation` |
| `enter` → `acceptPreview` | `enter` → `acceptPreview` (unchanged) |
New command (cornerstone extension, `CORNERSTONE` context):
```ts
// extensions/cornerstone/src/commandsModule.ts
cancelActiveOperation: () => {
actions.rejectPreview(); // discard a provisional segmentation preview
actions.cancelMeasurement(); // cancel an in-progress annotation draw
},
```
Both `rejectPreview` and `cancelMeasurement` remain available as standalone
commands; only their default `esc` hotkey bindings changed.
## Migration
Most applications need no changes — the default behavior simply works as
expected now.
**If you provide a custom `ohif.hotkeyBindings` customization** and want the
same consolidated behavior, bind `esc` to the new command and remove the old
duplicate `esc` entries:
**Before (3.12):**
```ts
'ohif.hotkeyBindings': [
// ...
{ commandName: 'cancelMeasurement', label: 'Cancel Measurement', keys: ['esc'] },
{ commandName: 'acceptPreview', label: 'Accept Preview', keys: ['enter'] },
{ commandName: 'rejectPreview', label: 'Reject Preview', keys: ['esc'] },
];
```
**After (3.13):**
```ts
'ohif.hotkeyBindings': [
// ...
{ commandName: 'cancelActiveOperation', label: 'Cancel', keys: ['esc'] },
{ commandName: 'acceptPreview', label: 'Accept Preview', keys: ['enter'] },
];
```
**If you ran the `cancelMeasurement` or `rejectPreview` command directly** (for
example from a toolbar button or another command), no change is required — both
commands still exist with the same behavior.
> **User key remaps:** the per-user hotkey overrides stored in `localStorage`
> (`user-preferred-keys`) are keyed by command hash. A user who had personally
> remapped the old `cancelMeasurement` or `rejectPreview` key will fall back to
> the new `esc` default for `cancelActiveOperation`, since those old command
> hashes no longer exist in the defaults.
## Reason
Binding two separate commands to the same key is inherently fragile — only the
last registered binding survives. Routing `Escape` through a single
orchestrating command removes the shadowing bug, keeps each underlying command
single-purpose, and makes the "discard whatever is in progress" intent explicit.
@@ -6,7 +6,6 @@ title: 3.12 to 3.13 Migration Guide
---
import DocCardList from '@theme/DocCardList';
import { useCurrentSidebarCategory } from '@docusaurus/theme-common';
# 3.12 to 3.13 Migration Guide
@@ -24,5 +23,8 @@ The largest changes in 3.13 are infrastructure-level:
is now **24**.
- **[SegmentationService](./segmentation-service.md)** — the
`removeSegmentationRepresentations` method was renamed.
- **[DICOM video viewport](./dicom-video.md)** — the
`@ohif/extension-dicom-video.viewportModule.dicom-video` namespace was
removed; route DICOM video display sets through the Cornerstone viewport.
<DocCardList items={useCurrentSidebarCategory().items.filter(item => item.docId !== 'migration-guide/3p12-to-3p13/index')} />
<DocCardList />
@@ -6,7 +6,6 @@ summary: Migration guide for segmentation architecture changes in OHIF 3.9, cove
---
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
:::info
This migration involves significant architectural changes to the segmentation system. While we typically aim for incremental updates, the shift from a tool group-centric to a viewport-centric architecture was necessary to support OHIF 3.9's advanced visualization capabilities, and more flexible segmentation handling.
@@ -15,4 +14,4 @@ Don't worry - we'll guide you through each change step by step!
:::
<DocCardList items={useCurrentSidebarCategory().items}/>
<DocCardList />
@@ -7,8 +7,7 @@ summary: Migration guide for upgrading from OHIF 3.8 to 3.9, covering segmentati
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
## Migration Guide Sections
<DocCardList items={useCurrentSidebarCategory().items}/>
<DocCardList />
@@ -12,7 +12,7 @@ summary: Migration guide for OHIF 3.10's new color system, explaining the transi
* **Component Abstraction:** Some styling, especially for interactive elements like buttons, has been abstracted into components (e.g., `ViewportActionButton`, UI library buttons) which use predefined variants (`default`, `secondary`, `ghost`) instead of manual style combinations.
:::note
You can look at the set of colors in the [Color System](/colors-and-type)
You can look at the set of colors in the [Color System](/colors-and-theming)
:::
@@ -13,7 +13,7 @@ This guide explains how to migrate from the existing `Input`, `InputNumber`, `In
## Why Migrate?
See the full list of components in the [Numeric Component Showcase](/components-list#numeric)
See the full list of components in the [Numeric Component](/components/numeric)
The old components relied heavily on props, making them complex and difficult to maintain and apply custom styles. The new `Numeric` component provides a structured approach with a context-based API, reducing prop clutter and improving reusability.
+1 -2
View File
@@ -6,10 +6,9 @@ summary: Introduction to OHIF migration guides covering the upgrade paths betwee
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
# Migration Guides
Based on the version you are migrating from, you can find the migration guide for the latest version of the platform.
<DocCardList items={useCurrentSidebarCategory().items}/>
<DocCardList />
@@ -1,7 +1,8 @@
---
sidebar_label: Measurements
title: Measurements Customization
summary: Documentation for customizing OHIF's measurement tools and displays, including how to modify display formats, annotation behaviors, and tracking interfaces for medical imaging measurements.
sidebar_position: 4
sidebar_position: 5
---
@@ -1,7 +1,8 @@
---
sidebar_label: Segmentation
title: Segmentation Customization
summary: Documentation for customizing OHIF's segmentation tools and visualization options, including configuration for segment rendering, color schemes, and interaction behaviors for medical image segmentation workflows.
sidebar_position: 5
sidebar_position: 6
---
@@ -1,7 +1,8 @@
---
sidebar_label: Study Browser
title: Study Browser Customization
summary: Documentation for customizing OHIF's Study Browser component, including configuration options for thumbnails, sorting functions, and display formats to enhance study navigation and selection workflows.
sidebar_position: 6
sidebar_position: 7
---
# Study Browser
@@ -1,7 +1,8 @@
---
sidebar_label: Viewport Scrollbar
title: Viewport Scrollbar Customization
summary: Documentation for configuring OHIF viewport scrollbar behavior, including progress vs legacy mode, loaded/viewed tracking visuals, loading pattern behavior, timing controls, and viewportScrollbar.indicator (size + optional custom indicator).
sidebar_position: 7
sidebar_position: 9
---
# Viewport Scrollbar
@@ -1,7 +1,8 @@
---
sidebar_label: Work List
title: Work List Customization
summary: Documentation for configuring the OHIF WorkList study-list route — selecting between the new (default) and legacy variants, the preview panel's series view (thumbnails, list, or both), and the columns shown in the study-list table.
sidebar_position: 9
sidebar_position: 10
---
# Work List
@@ -1,7 +1,8 @@
---
sidebar_label: Advanced
title: Advanced Customization
summary: Documentation for advanced OHIF customization techniques, including inheritance patterns, transform functions, and dynamic assembly of customizations to create sophisticated configurations across the platform.
sidebar_position: 8
sidebar_position: 11
---
@@ -0,0 +1,379 @@
---
sidebar_position: 2
sidebar_label: Appearance & Theming
title: Appearance & Theming
summary: Documentation for OHIF's appearance and theming system, including theme presets, custom themes, URL-based theme selection, and how to enable the Appearance dialog for your deployment.
---
# Appearance & Theming
OHIF includes an optional theming system that lets users switch between visual
theme presets, apply custom CSS token overrides, and share themes via URL. The
system is **not enabled by default** — deployers opt in by adding a single
configuration line.
## Enabling the Theme Module
The theming system is delivered as a customization module in the default
extension. To enable it, add the module reference to the `customizationService`
array in your configuration file:
```js
window.config = {
// ...
customizationService: [
'@ohif/extension-default.customizationModule.theme',
],
// ...
};
```
This single line activates the entire theming system:
- The **Appearance** menu item appears in the viewer header and study list
settings
- Users can switch between theme presets via a dropdown
- The active theme persists across sessions via `localStorage`
- Themes can be applied via URL parameter (`?theme=orchid`)
- Custom CSS token overrides can be pasted and applied
### What Happens Without It
When the theme module is not in the configuration:
- No Appearance menu item is shown anywhere in the UI
- No theme provider is mounted in the component tree
- URL parameters like `?theme=orchid` have no effect
- No `localStorage` keys are read or written
- Zero runtime footprint — the theming code does not execute
This opt-in design ensures that deployments that don't need theming pay no cost
for it.
## Theme Presets
OHIF ships with six built-in theme presets organized into two families:
### Tonal Presets
Tonal presets introduce a color hue throughout the interface — backgrounds,
borders, and surfaces all carry the theme's signature color.
| Preset | Description |
|--------|-------------|
| **Orchid** | Purple/violet tones with warm highlights |
| **Arctic** | Cool blue tones with icy surfaces |
| **Verdant** | Green tones with natural, earthy surfaces |
### Neutral Presets
Neutral presets keep surfaces achromatic (grays and blacks) and use color only
for interactive elements and highlights.
| Preset | Description |
|--------|-------------|
| **Midnight** | Deep blacks with subtle gray layering |
| **Slate** | Cool neutral grays with blue highlights |
| **Deep** | Rich dark surfaces with minimal contrast |
### Selecting a Preset
Open the Appearance dialog from the header menu (or study list settings) and
choose a preset from the Theme dropdown. The theme applies immediately and
persists across sessions.
## URL-Based Theme Selection
Themes can be applied via URL parameter, which is useful for sharing links with a
specific visual configuration:
```
https://your-ohif-instance.com/viewer?theme=orchid
```
Valid values are any preset name: `default`, `orchid`, `arctic`, `verdant`,
`midnight`, `slate`, `deep`.
The URL parameter takes precedence over the stored theme. When a URL theme is
applied, it is also saved to `localStorage` so the user's session continues with
that theme after navigation.
:::note
The `custom` theme value is deliberately not URL-addressable. Custom themes rely
on CSS stored in the user's `localStorage`, so a `?theme=custom` link would land
the app in a state with no CSS behind it.
:::
## Custom Themes
The Appearance dialog includes a custom theme feature that allows pasting CSS
variable overrides directly into the viewer.
### How It Works
1. Open the Appearance dialog
2. Click **Custom Theme** to expand the text area
3. Paste CSS variable declarations (one per line):
```css
--background: 270 45% 6%;
--foreground: 280 15% 96%;
--card: 268 40% 10%;
--primary: 270 85% 65%;
--border: 268 30% 18%;
```
4. Click **Apply**
The viewer parses the variables and injects them as CSS overrides into both
`:root` and `.dark` selectors. Invalid lines are silently skipped. If no valid
variables are found, the Apply button shows an error message.
Click **Clear** to remove the custom theme and return to the default appearance.
### Token Format
Theme tokens use **HSL triplets without the `hsl()` wrapper** — just the three
space-separated values:
```
--token-name: hue saturation% lightness%;
```
For example: `--primary: 270 85% 65%` represents a purple hue at 85% saturation
and 65% lightness.
### Available Tokens
The theming system uses the same token set as the base OHIF design system. The
most commonly customized tokens are:
| Token | Purpose |
|-------|---------|
| `--background` | Page/viewport background |
| `--foreground` | Default text color |
| `--card` | Surface color for cards and panels |
| `--popover` | Elevated surface color (dropdowns, tooltips) |
| `--primary` | Primary interactive color (buttons, links) |
| `--secondary` | Secondary surface color |
| `--muted` | Subdued background areas |
| `--muted-foreground` | Subdued text color |
| `--accent` | Accent surface color |
| `--border` | Border color |
| `--input` | Input field background |
| `--ring` | Focus ring color |
| `--highlight` | Highlight/selection color |
| `--destructive` | Error/destructive action color |
Each token also has a corresponding `-foreground` variant for text on that
surface (e.g., `--card-foreground`, `--primary-foreground`).
## Preset File Format
Theme presets are defined as JSON files in
`platform/ui-next/src/themes/`. Each file follows this structure:
```json
{
"name": "orchid",
"label": "Tonal: Orchid",
"cssVars": {
"dark": {
"highlight": "292 75% 62%",
"background": "270 45% 6%",
"foreground": "280 15% 96%",
"card": "268 40% 10%",
"primary": "270 85% 65%",
"border": "268 30% 18%"
}
}
}
```
| Field | Description |
|-------|-------------|
| `name` | Internal identifier. Must be unique and URL-safe. Used as the CSS class name (`theme-{name}`) and `?theme=` value. |
| `label` | Display label shown in the Appearance dialog dropdown. |
| `cssVars.dark` | Object mapping token names to HSL triplet values. Only tokens that differ from the default theme need to be specified. |
The corresponding CSS class is defined in `platform/ui-next/src/themes/themes.css`
and applies the token overrides when the class is added to `document.body`.
## Adding a Theme Preset
To add a new preset to the Appearance dialog dropdown, three files need to be
updated:
### 1. Create the JSON file
Add a new JSON file in `platform/ui-next/src/themes/`. Use an existing preset as
a template:
```json
{
"name": "ember",
"label": "Tonal: Ember",
"cssVars": {
"dark": {
"highlight": "15 85% 55%",
"background": "12 40% 5%",
"foreground": "20 15% 96%",
"card": "10 35% 9%",
"primary": "15 80% 50%",
"border": "12 25% 16%"
}
}
}
```
The `name` must be unique and URL-safe — it becomes the CSS class name
(`theme-ember`) and the `?theme=` URL value. Only include tokens that differ from
the default theme.
### 2. Add the CSS class to `themes.css`
Add a corresponding class in `platform/ui-next/src/themes/themes.css` with the
same token values:
```css
/* ─── Tonal: Ember ──────────────────────────────────────────────────── */
.theme-ember {
--highlight: 15 85% 55%;
--background: 12 40% 5%;
--foreground: 20 15% 96%;
--card: 10 35% 9%;
--primary: 15 80% 50%;
--border: 12 25% 16%;
/* ... all tokens from the JSON */
}
```
:::note
The JSON and CSS must define the same tokens with the same values. The JSON is
used for metadata (name, label) and validation. The CSS is what actually applies
the theme at runtime via the body class.
:::
### 3. Register in the barrel export
Import the JSON file and add it to the `themePresets` array in
`platform/ui-next/src/themes/index.ts`:
```ts
import orchid from './orchid.json';
import arctic from './arctic.json';
import verdant from './verdant.json';
import midnight from './midnight.json';
import slate from './slate.json';
import deep from './deep.json';
import ember from './ember.json'; // add import
export const themePresets: ThemePreset[] = [
orchid, arctic, verdant, midnight, slate, deep, ember // add to array
];
```
The order of the array determines the order in the dropdown menu.
## Removing a Theme Preset
To remove a preset, reverse the three steps above:
1. **Remove from `index.ts`** — delete the import and remove it from the
`themePresets` array
2. **Remove from `themes.css`** — delete the `.theme-{name}` class block
3. **Delete the JSON file** — remove the file from `platform/ui-next/src/themes/`
Users who had the removed theme active will fall back to the default theme on
their next visit — the provider validates stored theme names against the current
preset list and resets invalid values.
## Architecture
### How the Provider Registers
The theming system uses OHIF's `serviceProvidersManager` to register its React
provider dynamically. During app initialization, the default extension's
`preRegistration` hook checks whether the theme module is present in the
configuration. If it is, `ActiveThemeProvider` is registered into the component
tree:
```
App initializes
→ Default extension's preRegistration runs
→ Checks config for 'customizationModule.theme'
→ If present: registerProvider('activeTheme', ActiveThemeProvider)
→ App.tsx builds the provider tree
→ Picks up registered providers automatically
```
App.tsx has no knowledge of theming. The extension that provides the theme module
also decides whether to register its provider.
### How the Menu Item Appears
The Appearance menu item is gated by the customization service. Both the viewer
header (`ViewerHeader.tsx`) and the study list settings
(`StudyListSettingsPopover.tsx`) call:
```tsx
const AppearanceModal = customizationService.getCustomization('ohif.appearanceModal');
```
If the customization is not registered (because the theme module wasn't enabled),
the call returns `undefined` and no menu item is rendered.
### State Management
`ActiveThemeProvider` manages theme state via React context:
- **Active theme**: stored in component state and `localStorage` (`ohif:theme`)
- **Custom CSS**: stored in component state and `localStorage` (`ohif:custom-theme-css`)
- **CSS classes**: applied to `document.body` (`theme-{name}`)
- **Custom styles**: injected via a `<style>` element (`#ohif-custom-theme`)
The `useActiveTheme()` hook exposes the full API:
```tsx
const {
activeTheme, // Current theme name ('default', 'orchid', 'custom', etc.)
setActiveTheme, // Switch to a named preset
customCss, // Raw custom CSS text
applyCustomTheme, // Parse and apply custom CSS, returns boolean
clearCustomTheme, // Remove custom theme, revert to default
} = useActiveTheme();
```
## Configuration Reference
### Minimal Setup
```js
window.config = {
customizationService: [
'@ohif/extension-default.customizationModule.theme',
],
};
```
### With Other Customization Modules
The theme module can be combined with other customization modules:
```js
window.config = {
customizationService: [
'@ohif/extension-default.customizationModule.theme',
'@ohif/extension-cornerstone-dicom-seg.customizationModule.dicom-seg-sorts',
],
};
```
### Setting a Default Theme via URL
To link directly to a themed viewer session:
```
https://your-ohif-instance.com/viewer?StudyInstanceUIDs=1.2.3&theme=arctic
```
The theme parameter works alongside all other URL parameters.
@@ -1,6 +1,6 @@
---
sidebar_label: Custom Routes
sidebar_position: 2
sidebar_position: 4
title: Custom Routes
summary: Documentation for creating custom routes in OHIF, allowing extensions to define new URL paths and React components to extend the application with additional pages and navigation options.
---
@@ -543,4 +543,9 @@ needless to say if you opted to choose `name: default` in the `getCustomizationM
Below we are providing the example configuration for global scenario (using the configuration file), however, you can also use the `setCustomizations` method to set the customizations.
In addition to the parts listed in the table below, the
[Appearance & Theming](./appearance-theming.md) system is delivered as a
customization module (`@ohif/extension-default.customizationModule.theme`) that
adds theme preset switching, custom CSS overrides, and URL-based theme selection.
{TableGenerator(customizations)}
@@ -1,6 +1,6 @@
---
sidebar_label: Viewport Overlay
sidebar_position: 1
sidebar_position: 8
title: Viewport Overlay Customization
summary: Documentation for customizing OHIF's viewport overlays, allowing configuration of the information displayed in each corner (top-right, top-left, bottom-left, bottom-right) of medical imaging viewports.
---
-168
View File
@@ -1,168 +0,0 @@
---
sidebar_position: 2
sidebar_label: Theming
title: Theming the OHIF Viewer
summary: Documentation on customizing the visual appearance of the OHIF Viewer using Tailwind CSS and white-labeling capabilities, including how to modify the color scheme, add custom layouts via the LayoutTemplateModule, and replace the application logo with custom branding.
---
# Viewer: Theming
`OHIF-v3` has introduced the
[`LayoutTemplateModule`](./extensions/modules/layout-template.md) which enables
addition of custom layouts. You can easily design your custom components inside
an extension and consume it via the layoutTemplate module you write.
## Tailwind CSS
[Tailwind CSS](https://tailwindcss.com/) is a utility-first CSS framework for
creating custom user interfaces.
Below you can see a compiled version of the tailwind configs. Each section can
be edited accordingly. For instance screen size break points, primary and
secondary colors, etc.
```js
module.exports = {
prefix: '',
important: false,
separator: ':',
theme: {
screens: {
sm: '640px',
md: '768px',
lg: '1024px',
xl: '1280px',
},
colors: {
overlay: 'rgba(0, 0, 0, 0.8)',
transparent: 'transparent',
black: '#000',
white: '#fff',
initial: 'initial',
inherit: 'inherit',
indigo: {
dark: '#0b1a42',
},
aqua: {
pale: '#7bb2ce',
},
primary: {
light: '#5acce6',
main: '#0944b3',
dark: '#090c29',
active: '#348cfd',
},
secondary: {
light: '#3a3f99',
main: '#2b166b',
dark: '#041c4a',
active: '#1f1f27',
},
common: {
bright: '#e1e1e1',
light: '#a19fad',
main: '#fff',
dark: '#726f7e',
active: '#2c3074',
},
customgreen: {
100: '#05D97C',
},
customblue: {
100: '#c4fdff',
200: '#38daff',
},
},
},
};
```
You can also use the color variable like before. For instance:
```js
primary: {
default: ‘var(--default-color)‘,
light: ‘#5ACCE6’,
main: ‘#0944B3’,
dark: ‘#090C29’,
active: ‘#348CFD’,
}
```
## White Labeling
A white-label product is a product or service produced by one company (the
producer) that other companies (the marketers) rebrand to make it appear as if
they had made it -
[Wikipedia: White-Label Product](https://en.wikipedia.org/wiki/White-label_product)
Current white-labeling options are limited. We expose the ability to replace the
"Logo" section of the application with a custom "Logo" component. You can do
this by adding a whiteLabeling key to your configuration file.
```js
window.config = {
/** .. **/
whiteLabeling: {
createLogoComponentFn: function(React) {
return React.createElement(
'a',
{
target: '_blank',
rel: 'noopener noreferrer',
className: 'text-white underline',
href: 'http://radicalimaging.com',
},
React.createElement('h5', {}, 'RADICAL IMAGING')
);
},
},
/** .. **/
};
```
> You can simply use the stylings from tailwind CSS in the whiteLabeling
In addition to text, you can also add your custom logo
```js
window.config = {
/** .. **/
whiteLabeling: {
createLogoComponentFn: function(React) {
return React.createElement(
'a',
{
target: '_self',
rel: 'noopener noreferrer',
className: 'text-purple-600 line-through',
href: '/',
},
React.createElement('img', {
src: './customLogo.svg',
// className: 'w-8 h-8',
})
);
},
},
/** .. **/
};
```
The output will look like
![custom-logo](../assets/img/custom-logo.png)
<!--
Links
-->
<!-- prettier-ignore-start -->
[wikipedia]: https://en.wikipedia.org/wiki/White-label_product
<!-- prettier-ignore-end -->
+17 -82
View File
@@ -1,6 +1,10 @@
// read this text file
const fs = require('fs');
const versions = fs.readFileSync('../../version.txt', 'utf8').split('\n');
const rawVersion = fs.readFileSync('../../version.txt', 'utf8').trim();
const [major, minor] = rawVersion.split('.');
const versionLabel = rawVersion.includes('beta')
? `${major}.${minor} Beta`
: `${major}.${minor}`;
const ArchivedVersionsDropdownItems = [
{
@@ -35,7 +39,11 @@ const baseUrl = process.env.BASE_URL || '/';
/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
future: {
experimental_faster: true,
faster: true,
v4: {
removeLegacyPostBuildHeadAttribute: true,
useCssCascadeLayers: true,
},
},
title: 'OHIF',
tagline: 'Open-source web-based medical imaging platform',
@@ -49,7 +57,11 @@ module.exports = {
locales: ['en'],
},
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
markdown: {
hooks: {
onBrokenMarkdownLinks: 'throw',
},
},
favicon: 'img/favicon.ico',
themes: ['@docusaurus/theme-live-codeblock'],
plugins: [
@@ -97,7 +109,7 @@ module.exports = {
// : undefined,
versions: {
current: {
label: `${versions} (Latest)`,
label: `${versionLabel} (Latest)`,
},
},
},
@@ -181,12 +193,6 @@ module.exports = {
label: 'Help',
position: 'left',
},
{
to: '/migration-guide/3p10-to-3p11/',
//activeBaseRegex: '(^/help$)|(/help)',
label: '3.11 Migration Guides',
position: 'left',
},
{
type: 'docsVersionDropdown',
position: 'right',
@@ -229,78 +235,7 @@ module.exports = {
},
footer: {
style: 'dark',
links: [
{
title: ' ',
items: [
{
// This doesn't show up on dev for some reason, but displays in build
html: `
<a href="https://www.massgeneral.org/" target="_blank" rel="noreferrer noopener">
<img src="/img/mgh-logo.png" id="mgh-logo" alt="MGH" />
</a>
`,
},
],
},
{
title: 'Learn',
items: [
{
label: 'Introduction',
to: '/',
},
{
label: 'Getting Started',
to: 'development/getting-started',
},
{
label: 'FAQ',
to: '/faq',
},
{
label: 'Resources',
to: '/resources',
},
],
},
{
title: 'Community',
items: [
{
label: 'Discussion board',
href: 'https://community.ohif.org/',
},
{
label: 'Help',
to: '/help',
},
],
},
{
title: 'More',
items: [
{
label: 'Donate',
href: 'https://giving.massgeneral.org/ohif',
},
{
label: 'GitHub',
href: 'https://github.com/OHIF/Viewers',
},
{
label: 'Twitter',
href: 'https://twitter.com/OHIFviewer',
},
],
},
],
logo: {
alt: 'OHIF ',
src: 'img/netlify-color-accent.svg',
href: 'https://viewer.ohif.org/',
},
copyright: `OHIF is open source software released under the MIT license.`,
links: [],
},
}),
};
+15 -14
View File
@@ -1,6 +1,6 @@
{
"name": "ohif-docs",
"version": "3.13.0-beta.103",
"version": "3.13.0-beta.111",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
@@ -22,19 +22,19 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "3.7.0",
"@docusaurus/faster": "3.7.0",
"@docusaurus/module-type-aliases": "3.7.0",
"@docusaurus/plugin-client-redirects": "3.7.0",
"@docusaurus/plugin-google-gtag": "3.7.0",
"@docusaurus/plugin-ideal-image": "3.7.0",
"@docusaurus/plugin-pwa": "3.7.0",
"@docusaurus/preset-classic": "3.7.0",
"@docusaurus/remark-plugin-npm2yarn": "3.7.0",
"@docusaurus/theme-classic": "3.7.0",
"@docusaurus/theme-live-codeblock": "3.7.0",
"@docusaurus/tsconfig": "3.0.0",
"@docusaurus/types": "3.0.0",
"@docusaurus/core": "3.10.1",
"@docusaurus/faster": "3.10.1",
"@docusaurus/module-type-aliases": "3.10.1",
"@docusaurus/plugin-client-redirects": "3.10.1",
"@docusaurus/plugin-google-gtag": "3.10.1",
"@docusaurus/plugin-ideal-image": "3.10.1",
"@docusaurus/plugin-pwa": "3.10.1",
"@docusaurus/preset-classic": "3.10.1",
"@docusaurus/remark-plugin-npm2yarn": "3.10.1",
"@docusaurus/theme-classic": "3.10.1",
"@docusaurus/theme-live-codeblock": "3.10.1",
"@docusaurus/tsconfig": "3.10.1",
"@docusaurus/types": "3.10.1",
"@mdx-js/react": "3.0.1",
"@radix-ui/react-accordion": "1.2.11",
"@radix-ui/react-checkbox": "1.3.2",
@@ -81,6 +81,7 @@
"tailwind-merge": "2.6.0",
"tailwindcss": "3.2.4",
"tailwindcss-animate": "1.0.7",
"tailwindcss-scoped-preflight": "3.5.9",
"typescript": "5.5.4",
"url-loader": "4.1.1"
},
+122 -202
View File
@@ -10,15 +10,17 @@
:root {
--highlight: 191 74% 63%;
--neutral: 213 22% 59%;
--background: 236 62% 5%;
--neutral-light: 214 69% 81%;
--neutral-dark: 214 16% 21%;
--background: 0 0% 0%;
--foreground: 0 0% 98%;
--card: 236 62% 5%;
--card: 234 64% 10%;
--card-foreground: 0 0% 98%;
--popover: 219 90% 15%;
--popover-foreground: 0 0% 98%;
--primary: 214 98% 60%;
--primary-foreground: 0 0% 98%;
--secondary: 214 66% 48%;
--secondary: 214 65% 36%;
--secondary-foreground: 200 50% 84%;
--muted: 234 64% 10%;
--muted-foreground: 200 46% 65%;
@@ -35,167 +37,24 @@
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
--radius: 0.5rem;
--badge-new-color: hsl(var(--primary-foreground));
--badge-new-background: linear-gradient(135deg, hsl(var(--highlight)), hsl(var(--primary)));
--badge-latest-stable-color: hsl(var(--primary));
}
.dark {
--background: 0 0% 3.9%;
--foreground: 0 0% 98%;
--card: 0 0% 3.9%;
--card-foreground: 0 0% 98%;
--popover: 0 0% 3.9%;
--popover-foreground: 0 0% 98%;
--primary: 214 98% 60%;
--primary-foreground: 0 0% 98%;
--secondary: 0 0% 14.9%;
--secondary-foreground: 0 0% 98%;
--muted: 0 0% 14.9%;
--muted-foreground: 0 0% 63.9%;
--accent: 0 0% 14.9%;
--accent-foreground: 0 0% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%;
--border: 0 0% 14.9%;
--input: 236 52% 30%;
--ring: 214 98% 60%;
--chart-1: 220 70% 50%;
--chart-2: 160 60% 45%;
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
--success-bg: hsl(143, 85%, 96%);
--success-border: hsl(145, 92%, 91%);
--success-text: hsl(140, 100%, 27%);
--info-bg: hsl(208, 100%, 97%);
--info-border: hsl(221, 91%, 91%);
--info-text: hsl(210, 92%, 45%);
--warning-bg: hsl(49, 100%, 97%);
--warning-border: hsl(49, 91%, 91%);
--warning-text: hsl(31, 92%, 45%);
--error-bg: hsl(359, 100%, 97%);
--error-border: hsl(359, 100%, 94%);
--error-text: hsl(360, 100%, 45%);
--badge-new-color: hsl(var(--primary-foreground));
--badge-new-background: linear-gradient(135deg, hsl(var(--highlight)), hsl(var(--primary)));
--badge-latest-stable-color: hsl(var(--primary));
}
}
/* ORIGINAL THEME for comparison and testing
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
--card: 0 0% 100%;
--card-foreground: 240 10% 3.9%;
--popover: 0 0% 100%;
--popover-foreground: 240 10% 3.9%;
--primary: 240 5.9% 10%;
--primary-foreground: 0 0% 98%;
--secondary: 240 4.8% 95.9%;
--secondary-foreground: 240 5.9% 10%;
--muted: 240 4.8% 95.9%;
--muted-foreground: 240 3.8% 46.1%;
--accent: 240 4.8% 95.9%;
--accent-foreground: 240 5.9% 10%;
--destructive: 0 72.22% 50.59%;
--destructive-foreground: 0 0% 98%;
--border: 240 5.9% 90%;
--input: 240 5.9% 90%;
--ring: 240 5% 64.9%;
--radius: 0.5rem;
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
}
.dark {
--background: 240 10% 3.9%;
--foreground: 0 0% 98%;
--card: 240 10% 3.9%;
--card-foreground: 0 0% 98%;
--popover: 240 10% 3.9%;
--popover-foreground: 0 0% 98%;
--primary: 0 0% 98%;
--primary-foreground: 240 5.9% 10%;
--secondary: 240 3.7% 15.9%;
--secondary-foreground: 0 0% 98%;
--muted: 240 3.7% 15.9%;
--muted-foreground: 240 5% 64.9%;
--accent: 240 3.7% 15.9%;
--accent-foreground: 0 0% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 85.7% 97.3%;
--border: 240 3.7% 15.9%;
--input: 240 3.7% 15.9%;
--ring: 240 4.9% 83.9%;
--chart-1: 220 70% 50%;
--chart-2: 160 60% 45%;
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
}
}
*/
/* Theme Copy Example
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 224 71.4% 4.1%;
--card: 0 0% 100%;
--card-foreground: 224 71.4% 4.1%;
--popover: 0 0% 100%;
--popover-foreground: 224 71.4% 4.1%;
--primary: 262.1 83.3% 57.8%;
--primary-foreground: 210 20% 98%;
--secondary: 220 14.3% 95.9%;
--secondary-foreground: 220.9 39.3% 11%;
--muted: 220 14.3% 95.9%;
--muted-foreground: 220 8.9% 46.1%;
--accent: 220 14.3% 95.9%;
--accent-foreground: 220.9 39.3% 11%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 20% 98%;
--border: 220 13% 91%;
--input: 220 13% 91%;
--ring: 262.1 83.3% 57.8%;
--radius: 0.5rem;
--chart-1: ;
--chart-2: ;
--chart-3: ;
--chart-4: ;
--chart-5: ;
}
.dark {
--background: 224 71.4% 4.1%;
--foreground: 210 20% 98%;
--card: 224 71.4% 4.1%;
--card-foreground: 210 20% 98%;
--popover: 224 71.4% 4.1%;
--popover-foreground: 210 20% 98%;
--primary: 263.4 70% 50.4%;
--primary-foreground: 210 20% 98%;
--secondary: 215 27.9% 16.9%;
--secondary-foreground: 210 20% 98%;
--muted: 215 27.9% 16.9%;
--muted-foreground: 217.9 10.6% 64.9%;
--accent: 215 27.9% 16.9%;
--accent-foreground: 210 20% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 20% 98%;
--border: 215 27.9% 16.9%;
--input: 215 27.9% 16.9%;
--ring: 263.4 70% 50.4%;
--chart-1: ;
--chart-2: ;
--chart-3: ;
--chart-4: ;
--chart-5: ;
}
}
*/
h2.section-header {
@apply py-4 text-2xl font-normal text-white;
}
@@ -348,31 +207,40 @@ body {
font-family: 'Inter', sans-serif;
}
h1,
h2,
h3,
h4,
h5 {
.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.theme-doc-markdown h1,
.theme-doc-markdown h2,
.theme-doc-markdown h3,
.theme-doc-markdown h4,
.theme-doc-markdown h5 {
color: var(--ifm-color-primary);
font-weight: 400;
font-family: 'Inter', sans-serif;
}
blockquote {
.markdown blockquote,
.theme-doc-markdown blockquote {
border-left: 3px solid #4042af;
}
/* Temporary Type Size Changes */
article header h1 {
.markdown article header h1,
.theme-doc-markdown article header h1 {
font-size: 2.6rem !important;
}
article h2 {
.markdown article h2,
.theme-doc-markdown article h2 {
font-size: 1.85rem !important;
}
article header h3 {
.markdown article header h3,
.theme-doc-markdown article header h3 {
font-size: 1.5rem !important;
}
@@ -398,6 +266,17 @@ article header h3 {
text-decoration: none;
}
.mit-license-link {
color: rgba(255, 255, 255, 0.5) !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.5);
text-decoration: none !important;
}
.mit-license-link:hover {
color: rgba(255, 255, 255, 0.7) !important;
border-bottom-color: rgba(255, 255, 255, 0.7);
}
.menu {
font-weight: 400;
font-size: 0.9rem;
@@ -483,21 +362,6 @@ html[data-theme='dark'] .docusaurus-highlight-code-line {
display: none;
} */
/* Footer logo MGH */
@media (max-width: 1200px) {
#mgh-logo {
margin-right: 100px;
width: 300px;
}
}
@media (max-width: 480px) {
#mgh-logo {
margin-right: 10px;
width: 300px;
}
}
.dropdown-separator {
margin: 0.3rem 0;
@@ -561,45 +425,38 @@ div[class^='announcementBar_'] {
align-items: center;
}
/* add proper ui link styling */
/* Bullet point styling */
ul {
/* List styling — scoped to doc content areas only */
.markdown ul,
.theme-doc-markdown ul {
list-style-type: disc;
padding-left: 1.5rem;
margin: 1rem 0;
}
ul li {
.markdown ul li,
.theme-doc-markdown ul li {
margin-bottom: 0.5rem;
}
ol {
.markdown ol,
.theme-doc-markdown ol {
list-style-type: decimal;
padding-left: 1.5rem;
margin: 1rem 0;
}
ol li {
.markdown ol li,
.theme-doc-markdown ol li {
margin-bottom: 0.5rem;
}
/* Nested bullet points */
ul ul {
.markdown ul ul,
.theme-doc-markdown ul ul {
list-style-type: circle;
margin: 0.5rem 0;
}
/* For documentation bullet points specifically */
.markdown ul {
list-style-type: disc;
padding-left: 1.5rem;
}
.markdown ul li {
margin-bottom: 0.5rem;
}
/* Markdown link styling */
.markdown a {
color: #0066cc;
@@ -621,6 +478,12 @@ html[data-theme='dark'] .markdown a:hover {
color: #99ccff;
}
/* Component sidebar — reset preflight borders that leak from .showcase-isolated */
.component-sidebar,
.component-sidebar * {
border-width: 0;
}
/* Horizontal rule styling */
.markdown hr {
height: 1px;
@@ -723,6 +586,63 @@ a.dropdown__link[href='/3.9/migration-guide/3p8-to-3p9/']::after {
margin-left: 4px;
}
li:first-child {
margin-top: 0.5em; /* Adjust '1em' to your desired spacing */
.markdown li:first-child,
.theme-doc-markdown li:first-child {
margin-top: 0.5em;
}
/* Isolate component showcases from Infima/Docusaurus styles.
Requires v4.useCssCascadeLayers: true in docusaurus.config.js */
.showcase-isolated:not(#a#b) {
&,
* {
@layer docusaurus.infima {
all: revert-layer;
}
}
}
/* Extend isolation to the showcase demos' portal content. Radix and Sonner
render floating UI (Dialog, Popover, Select, DropdownMenu, Tooltip, toasts)
as direct body children — outside #__docusaurus and .showcase-isolated — so
it misses both the revert-layer and the scoped preflight.
Scoped to the demos' OWN portal roots, NOT every body child:
- [data-radix-popper-content-wrapper] Popover, Combobox, DropdownMenu,
Select, Tooltip (all popper-based)
- .showcase-portal explicit hook on Dialog demo content
(Radix Dialog isn't popper-based)
- [data-sonner-toaster] Sonner toast container
This deliberately leaves third-party body portals (medium-zoom image overlay,
Algolia DocSearch modal) untouched, which the previous catch-all reset broke.
:where() keeps specificity at zero so Tailwind utility classes always win. */
:where([data-radix-popper-content-wrapper], .showcase-portal, [data-sonner-toaster]) {
font-family: Inter, sans-serif;
&,
* {
@layer docusaurus.infima {
all: revert-layer;
}
}
}
:where([data-radix-popper-content-wrapper], .showcase-portal, [data-sonner-toaster]),
:where([data-radix-popper-content-wrapper], .showcase-portal, [data-sonner-toaster]) * {
box-sizing: border-box;
border-width: 0;
border-style: solid;
border-color: transparent;
}
:where([data-radix-popper-content-wrapper], .showcase-portal, [data-sonner-toaster]) :where(button, input, select, textarea) {
font-family: inherit;
font-size: inherit;
font-weight: inherit;
line-height: inherit;
color: inherit;
margin: 0;
padding: 0;
background-color: transparent;
background-image: none;
}
@@ -0,0 +1,994 @@
import React, { useState } from 'react';
import '../css/custom.css';
import BrowserOnly from '@docusaurus/BrowserOnly';
const themes: Record<string, string> = {
default: `--highlight: 191 74% 63%;
--neutral: 213 22% 59%;
--neutral-light: 214 69% 81%;
--neutral-dark: 214 16% 21%;
--background: 0 0% 0%;
--foreground: 0 0% 98%;
--card: 234 64% 10%;
--card-foreground: 0 0% 98%;
--popover: 219 90% 15%;
--popover-foreground: 0 0% 98%;
--primary: 214 98% 60%;
--primary-foreground: 0 0% 98%;
--secondary: 214 65% 36%;
--secondary-foreground: 200 50% 84%;
--muted: 234 64% 10%;
--muted-foreground: 200 46% 65%;
--accent: 217 79% 24%;
--accent-foreground: 0 0% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%;
--border: 0 0% 14.9%;
--input: 236 52% 30%;
--ring: 214 98% 60%;`,
orchid: `--highlight: 292 75% 62%;
--neutral: 270 18% 55%;
--neutral-light: 275 35% 75%;
--neutral-dark: 268 20% 24%;
--background: 270 45% 6%;
--foreground: 280 15% 96%;
--card: 268 40% 10%;
--card-foreground: 280 15% 96%;
--popover: 264 48% 13%;
--popover-foreground: 280 15% 96%;
--primary: 270 85% 65%;
--primary-foreground: 0 0% 98%;
--secondary: 268 45% 32%;
--secondary-foreground: 275 45% 88%;
--muted: 268 40% 10%;
--muted-foreground: 272 30% 60%;
--accent: 268 50% 20%;
--accent-foreground: 280 15% 96%;
--destructive: 0 65% 40%;
--destructive-foreground: 0 0% 98%;
--border: 268 30% 18%;
--input: 268 40% 25%;
--ring: 270 80% 60%;`,
verdant: `--highlight: 152 79% 52%;
--neutral: 150 15% 52%;
--neutral-light: 145 30% 72%;
--neutral-dark: 155 18% 24%;
--background: 155 40% 5%;
--foreground: 140 15% 95%;
--card: 152 35% 9%;
--card-foreground: 140 15% 95%;
--popover: 167 65% 10%;
--popover-foreground: 140 15% 95%;
--primary: 152 75% 40%;
--primary-foreground: 155 50% 8%;
--secondary: 150 40% 26%;
--secondary-foreground: 145 40% 85%;
--muted: 152 35% 9%;
--muted-foreground: 148 25% 55%;
--accent: 150 45% 16%;
--accent-foreground: 140 15% 95%;
--destructive: 0 65% 38%;
--destructive-foreground: 0 0% 98%;
--border: 150 25% 16%;
--input: 150 35% 22%;
--ring: 152 75% 40%;`,
arctic: `--highlight: 173 81% 52%;
--neutral: 185 20% 55%;
--neutral-light: 180 40% 78%;
--neutral-dark: 190 18% 22%;
--background: 0 0% 0%;
--foreground: 180 10% 97%;
--card: 203 39% 9%;
--card-foreground: 180 10% 97%;
--popover: 202 54% 11%;
--popover-foreground: 180 10% 97%;
--primary: 175 85% 42%;
--primary-foreground: 185 50% 8%;
--secondary: 180 45% 28%;
--secondary-foreground: 175 50% 88%;
--muted: 203 39% 9%;
--muted-foreground: 185 30% 60%;
--accent: 185 55% 18%;
--accent-foreground: 180 10% 97%;
--destructive: 0 65% 35%;
--destructive-foreground: 0 0% 98%;
--border: 190 25% 17%;
--input: 223 40% 24%;
--ring: 175 85% 42%;`,
midnight: `--highlight: 188 90% 58%;
--neutral: 213 22% 59%;
--neutral-light: 214 69% 81%;
--neutral-dark: 214 16% 21%;
--background: 240 15% 3%;
--foreground: 0 0% 99%;
--card: 240 12% 8%;
--card-foreground: 0 0% 99%;
--popover: 225 45% 13%;
--popover-foreground: 0 0% 99%;
--primary: 210 100% 62%;
--primary-foreground: 0 0% 99%;
--secondary: 215 55% 32%;
--secondary-foreground: 200 60% 88%;
--muted: 240 12% 8%;
--muted-foreground: 210 40% 70%;
--accent: 220 65% 20%;
--accent-foreground: 0 0% 99%;
--destructive: 0 70% 35%;
--destructive-foreground: 0 0% 99%;
--border: 240 10% 18%;
--input: 225 35% 24%;
--ring: 210 100% 62%;`,
slate: `--highlight: 217 97% 52%;
--neutral: 0 0% 55%;
--neutral-light: 0 0% 75%;
--neutral-dark: 0 0% 25%;
--background: 0 0% 0%;
--foreground: 0 0% 96%;
--card: 0 0% 7%;
--card-foreground: 0 0% 96%;
--popover: 0 0% 9%;
--popover-foreground: 0 0% 96%;
--primary: 230 75% 55%;
--primary-foreground: 0 0% 98%;
--secondary: 0 0% 25%;
--secondary-foreground: 0 0% 85%;
--muted: 0 0% 7%;
--muted-foreground: 0 0% 60%;
--accent: 0 0% 18%;
--accent-foreground: 0 0% 96%;
--destructive: 0 65% 40%;
--destructive-foreground: 0 0% 98%;
--border: 0 0% 18%;
--input: 0 0% 22%;
--ring: 215 75% 55%;`,
deep: `--highlight: 184 53% 54%;
--neutral: 215 15% 50%;
--neutral-light: 210 20% 68%;
--neutral-dark: 220 18% 22%;
--background: 0 0% 0%;
--foreground: 215 15% 82%;
--card: 218 25% 5%;
--card-foreground: 215 15% 82%;
--popover: 215 30% 8%;
--popover-foreground: 215 15% 82%;
--primary: 200 43% 48%;
--primary-foreground: 210 20% 92%;
--secondary: 218 30% 18%;
--secondary-foreground: 215 25% 75%;
--muted: 214 28% 5%;
--muted-foreground: 215 18% 48%;
--accent: 216 32% 12%;
--accent-foreground: 215 15% 82%;
--destructive: 0 50% 35%;
--destructive-foreground: 0 15% 90%;
--border: 218 22% 10%;
--input: 216 28% 15%;
--ring: 215 45% 42%;`,
};
function Swatch({ color, size = 24 }: { color: string; size?: number }) {
return (
<span
className="inline-block rounded-full"
style={{
width: size,
height: size,
background: color,
border: '1px solid rgba(255,255,255,0.1)',
verticalAlign: 'middle',
flexShrink: 0,
}}
/>
);
}
function SwatchSm({ color }: { color: string }) {
return (
<span
className="mr-1.5 inline-block rounded-full align-middle"
style={{
width: 14,
height: 14,
background: color,
border: '1px solid rgba(255,255,255,0.1)',
}}
/>
);
}
function TokenRow({
color,
token,
children,
}: {
color: string;
token: string;
children: React.ReactNode;
}) {
return (
<div className="mb-5 grid items-start gap-x-3" style={{ gridTemplateColumns: '24px 200px 1fr' }}>
<Swatch color={color} />
<code className="bg-transparent pl-0 pt-0.5 text-sm text-[#7cacf8]">{token}</code>
<div className="text-secondary-foreground text-lg">{children}</div>
</div>
);
}
function SwatchSet({ colors }: { colors: string[] }) {
return (
<div className="flex items-center">
{colors.map((c, i) => (
<div
key={i}
className="rounded-full"
style={{
width: 36,
height: 36,
background: c,
border: '2px solid #232323',
marginLeft: i > 0 ? -13 : 0,
}}
/>
))}
</div>
);
}
function CopyThemeLink({ themeName }: { themeName: string }) {
const [copied, setCopied] = useState(false);
const handleCopy = async (e: React.MouseEvent) => {
e.preventDefault();
const tokens = themes[themeName];
if (!tokens) return;
try {
await navigator.clipboard.writeText(tokens);
} catch {
const textarea = document.createElement('textarea');
textarea.value = tokens;
textarea.style.position = 'fixed';
textarea.style.opacity = '0';
document.body.appendChild(textarea);
textarea.select();
document.execCommand('copy');
document.body.removeChild(textarea);
}
setCopied(true);
setTimeout(() => setCopied(false), 1500);
};
return (
<a
href="#"
onClick={handleCopy}
aria-label={`Copy ${themeName} theme tokens`}
className="whitespace-nowrap text-[13px] no-underline transition-colors"
style={{ color: copied ? '#6ee7b7' : '#7cacf8' }}
>
{copied ? 'Copied!' : 'Copy Theme'}
</a>
);
}
function ThemeRow({
backgrounds,
text,
interactive,
name,
previewUrl,
themeName,
}: {
backgrounds: string[];
text: string[];
interactive: string[];
name: string;
previewUrl: string;
themeName: string;
}) {
return (
<>
<SwatchSet colors={backgrounds} />
<SwatchSet colors={text} />
<SwatchSet colors={interactive} />
<span className="pl-3.5 text-[15px] text-[#999]">{name}</span>
<a
href={previewUrl}
target="_blank"
rel="noopener noreferrer"
aria-label={`Preview ${name} theme in Viewer`}
className="whitespace-nowrap text-[13px] text-primary no-underline hover:underline"
>
Preview in Viewer
</a>
<CopyThemeLink themeName={themeName} />
</>
);
}
function ContrastTable({
rows,
}: {
rows: Array<{
fgLabel: string;
fgColor: string;
bgLabel: string;
bgColor: string;
result: string;
requirement: string;
}>;
}) {
return (
<table className="my-4 mb-6 w-full border-collapse text-[15px]" style={{ tableLayout: 'fixed' }}>
<thead>
<tr>
<th className="border-b border-[#333] px-3 py-2 text-left text-[13px] font-medium uppercase tracking-wider text-[#999]" style={{ width: '30%' }}>Foreground</th>
<th className="border-b border-[#333] px-3 py-2 text-left text-[13px] font-medium uppercase tracking-wider text-[#999]" style={{ width: '30%' }}>Background</th>
<th className="border-b border-[#333] px-3 py-2 text-left text-[13px] font-medium uppercase tracking-wider text-[#999]" style={{ width: '16%' }}>Result</th>
<th className="border-b border-[#333] px-3 py-2 text-left text-[13px] font-medium uppercase tracking-wider text-[#999]" style={{ width: '24%' }}>Requirements</th>
</tr>
</thead>
<tbody>
{rows.map((r, i) => (
<tr key={i}>
<td className="border-b border-[#1a1a1a] px-3 py-2.5">
<SwatchSm color={r.fgColor} />
<code className="bg-transparent text-[13px] text-[#7cacf8]">{r.fgLabel}</code>
</td>
<td className="border-b border-[#1a1a1a] px-3 py-2.5">
<SwatchSm color={r.bgColor} />
<code className="bg-transparent text-[13px] text-[#7cacf8]">{r.bgLabel}</code>
</td>
<td className="border-b border-[#1a1a1a] px-3 py-2.5">{r.result}</td>
<td className="border-b border-[#1a1a1a] px-3 py-2.5 text-[#666]">{r.requirement}</td>
</tr>
))}
</tbody>
</table>
);
}
function Accordion({ title, id, children }: { title: string; id?: string; children: React.ReactNode }) {
const [open, setOpen] = useState(false);
const buttonId = id ? `${id}-button` : undefined;
const contentId = id ? `${id}-content` : undefined;
return (
<div id={id} className="my-2 mb-9 rounded-lg border border-[#222] bg-[#0a0a0a] px-5">
<button
id={buttonId}
type="button"
aria-expanded={open}
aria-controls={contentId}
onClick={() => setOpen(!open)}
className="flex w-full items-center bg-transparent py-4 text-left text-lg font-normal text-white"
style={{ border: 'none', cursor: 'pointer' }}
>
<span
aria-hidden="true"
className="mr-2 inline-block text-[#7cacf8] transition-transform"
style={{ transform: open ? 'rotate(90deg)' : 'none' }}
>
&#x25B8;
</span>
{title}
</button>
{open && (
<div id={contentId} role="region" aria-labelledby={buttonId} className="mb-4 border-t border-[#222] pt-4">
{children}
</div>
)}
</div>
);
}
const BASE_VIEWER = 'https://ohif-theme-apply.netlify.app/viewer?StudyInstanceUIDs=1.3.6.1.4.1.25403.345050719074.3824.20170125095438.5&theme=';
function ThemingPageContent() {
const ComponentLayout = require('./components/_layout/ComponentLayout').default;
const PageHeader = require('./components/_layout/PageHeader').default;
const Section = require('./components/_layout/Section').default;
return (
<ComponentLayout
title="Colors & Theming"
description="Color tokens, themes, and accessibility for the OHIF Viewer"
>
<PageHeader
title="Colors & Theming"
description="How color is used in the OHIF Viewer and how to apply new colors and themes for clinical use."
/>
{/* ================================ */}
{/* APPLYING THEMES */}
{/* ================================ */}
<Section title="Applying Themes">
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
The <strong className="text-foreground">Appearance</strong> dialog can be accessed from the settings menu in the
main header. Open the <strong className="text-foreground">Theme</strong> dropdown and choose a preset. The
interface will update immediately, and your selection is remembered the next time
you open the Viewer. Selecting <strong className="text-foreground">Tonal: OHIF Blue</strong> returns to the default.
</p>
<p>
<em className="text-muted-foreground">Testing custom theme colors:</em> Use this dialog to test your custom themes in
the viewer{' '}
<a href="#testing-themes" className="text-primary no-underline hover:underline">(see more details)</a>
</p>
<img
src="/img/theming-dialog-01-select-theme.png"
alt="Appearance modal with the Theme dropdown open, showing the preset options"
className="my-4 mb-6 w-full rounded-lg border border-[#222]"
/>
</div>
</Section>
{/* ================================ */}
{/* COLOR TOKENS AND ROLES */}
{/* ================================ */}
<Section title="Color Tokens and Roles">
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
While these token names are largely shared across many web applications, within the OHIF Viewer design,
each one plays a specific role in the interface.
</p>
<img
src="/img/theming-color-roles.png"
alt="Color roles overview"
className="my-6 mb-8 w-full"
/>
</div>
{/* Layering Model Accordion */}
<Accordion title="Layering Model: colors used for hierarchy" id="layering-model">
<p className="text-secondary-foreground mb-4 text-lg">
A set of three background colors are used to create a layering system that shows visual depth
and hierarchy in the product. Background color use should align with these details:
</p>
<h3 className="mt-7 mb-3 text-lg font-medium text-foreground">Three Levels</h3>
<p className="text-secondary-foreground mb-4 text-lg">
<strong className="text-foreground">Level 1: Surface</strong>{' '}
<Swatch color="hsl(0, 0%, 0%)" />{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">background</code>
</p>
<ul className="text-secondary-foreground mb-4 list-disc pl-6 text-lg">
<li className="mb-2">The base layer of the entire interface</li>
<li className="mb-2">Includes the app shell, panel backgrounds, and empty or negative space</li>
<li className="mb-2">In the default OHIF theme, this is black to seamlessly match the viewport background</li>
<li className="mb-2">Changing this from black can create more separation from viewports or add a full background color to panels</li>
</ul>
<p className="text-secondary-foreground mb-4 text-lg">
<strong className="text-foreground">Level 2: Working Space</strong>{' '}
<Swatch color="hsl(234, 64%, 10%)" />{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">muted</code> or{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">card</code>
</p>
<ul className="text-secondary-foreground mb-4 list-disc pl-6 text-lg">
<li className="mb-2">This is the base content layer of the interface</li>
<li className="mb-2">Includes panel content areas, dialog backgrounds, rows of data, etc.</li>
<li className="mb-2">This is the base of the working space separated from the viewer content</li>
</ul>
<p className="text-secondary-foreground mb-4 text-lg">
<strong className="text-foreground">Level 3: Elevated</strong>{' '}
<Swatch color="hsl(219, 90%, 15%)" />{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">popover</code>
</p>
<ul className="text-secondary-foreground mb-4 list-disc pl-6 text-lg">
<li className="mb-2">The top-most layer, used for UI that floats above the surface</li>
<li className="mb-2">Includes popovers, dropdown menus, floating components, grouping elements such as panel sections</li>
<li className="mb-2">Use this for any component that needs to appear &quot;above&quot; the content layer</li>
</ul>
<img
src="/img/theming-layers.png"
alt="Layering model overview"
className="my-6 mb-8 w-full"
/>
<h3 className="mt-7 mb-3 text-lg font-medium text-foreground">Creating Contrast</h3>
<ul className="text-secondary-foreground mb-4 list-disc pl-6 text-lg">
<li className="mb-2">
The <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">primary</code> color
is used across these different layers to show what elements are interactable. Be sure to review any
new colors for backgrounds work with <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">primary</code> as the foreground at each of the three different levels.
</li>
<li className="mb-2">
See the <a href="#creating-themes" className="text-primary no-underline hover:underline">Creating Themes</a> section
for details on how different levels of contrast can be used to separate these layers.
</li>
</ul>
<h3 className="mt-7 mb-3 text-lg font-medium text-foreground">Alpha Colors</h3>
<p className="text-secondary-foreground mb-4 text-lg">
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">primary</code> also uses
various alpha values for many components across the product. This allows components to adapt and work
well with different background colors or various layers of the interface.
</p>
</Accordion>
{/* Token Sections */}
<div className="ml-[248px]">
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Interactive or Currently Active</h3>
</div>
<TokenRow color="hsl(214, 98%, 60%)" token="primary">
The most important color in the system. Primary represents anything the user can interact with
which includes: tool actions, toggles for showing and hiding content, links, navigation elements, etc.
</TokenRow>
<TokenRow color="hsl(191, 74%, 63%)" token="highlight">
The brightest color in the system. Highlight is used to show the user what is &quot;currently active&quot;.
It should not be used more than a few times in flows or screen views.
<ul className="mt-2 list-disc pl-6">
<li className="mb-1">Highlight border around the active viewport</li>
<li className="mb-1">Highlight background to show the active tool</li>
<li className="mb-1">Highlight color at the end of a selected data row</li>
</ul>
</TokenRow>
<div className="ml-[248px]">
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Text and Content</h3>
</div>
<TokenRow color="hsl(0, 0%, 98%)" token="foreground">
Used for standard text or for more important text to stand out. This includes headings,
labels for controls, or anything critical for what the user is doing.
</TokenRow>
<TokenRow color="hsl(200, 46%, 65%)" token="muted-foreground">
Used for secondary text that is paired with standard text. This includes sub titles,
help text, or anything that needs to play a reduced role for content.
</TokenRow>
<div className="ml-[248px]">
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Background Colors</h3>
<p className="text-secondary-foreground mb-4 text-lg">
See the <a href="#layering-model" className="text-primary no-underline hover:underline">Layering Model</a> above for detailed notes.
</p>
</div>
<TokenRow color="hsl(0, 0%, 0%)" token="background">
The base background layer of the product (app shell, panels, negative spaces)
</TokenRow>
<TokenRow color="hsl(234, 64%, 10%)" token="muted">
The second background layer where most content lives
</TokenRow>
<TokenRow color="hsl(219, 90%, 15%)" token="popover">
The third background layer for any content that needs to be elevated
</TokenRow>
<div className="ml-[248px]">
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Supporting Colors</h3>
</div>
<TokenRow color="hsl(214, 65%, 36%)" token="secondary">
Used for secondary buttons in the interface
</TokenRow>
<TokenRow color="hsl(200, 50%, 84%)" token="secondary-foreground">
Text color used on secondary
</TokenRow>
<TokenRow color="hsl(217, 79%, 24%)" token="accent">
Sometimes used for hover states or other interaction feedback
</TokenRow>
<TokenRow color="hsl(0, 0%, 98%)" token="accent-foreground">
Text color used on accent
</TokenRow>
<TokenRow color="hsl(0, 62.8%, 30.6%)" token="destructive">
Used for any destructive action or operations in the interface
</TokenRow>
<TokenRow color="hsl(0, 0%, 98%)" token="destructive-foreground">
Text color used on destructive
</TokenRow>
<div className="ml-[248px]">
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Inputs and Borders</h3>
</div>
<TokenRow color="hsl(236, 52%, 30%)" token="input">
Used on input fields and other interactive components
</TokenRow>
<TokenRow color="hsl(0, 0%, 14.9%)" token="border">
A neutral color used minimally as separators
</TokenRow>
<TokenRow color="hsl(214, 98%, 60%)" token="ring">
Used as focus rings for accessibility &mdash; indicates which components are currently selected
(in use or keyboard highlighted)
</TokenRow>
<div className="ml-[248px]">
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Neutral Colors</h3>
<p className="text-secondary-foreground mb-4 text-lg">
Neutral colors are used sparingly across the interface in areas such as viewports.
</p>
</div>
<TokenRow color="hsl(213, 22%, 59%)" token="neutral">
Used for elements like scrollbars in viewports
</TokenRow>
<TokenRow color="hsl(214, 69%, 81%)" token="neutral-light">
Lighter text that appears over dark background viewports
</TokenRow>
<TokenRow color="hsl(214, 16%, 21%)" token="neutral-dark">
Darker text that appears over light background viewports
</TokenRow>
</Section>
{/* ================================ */}
{/* CREATING THEMES */}
{/* ================================ */}
<Section title="Creating Themes">
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<img
src="/img/theming-themes.png"
alt="Creating themes overview"
className="my-6 mb-8 w-full"
/>
<p>
Theming in the OHIF Viewer works by replacing the default color tokens and working with the product
color system outlined in{' '}
<a href="#color-tokens-and-roles" className="text-primary no-underline hover:underline">Color Tokens and Roles</a> and{' '}
<a href="#layering-model" className="text-primary no-underline hover:underline">Layering Model</a>.
</p>
<p>
When updating any colors in the system, follow the{' '}
<a href="#accessibility" className="text-primary no-underline hover:underline">Accessibility</a> section to ensure the
product retains accessibility standards.
</p>
<p>
OHIF can be themed with a few different approaches. Use the guidance below to match the desired
product or brand feel.
</p>
</div>
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Approach 1: Tonal</h3>
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
A tonal theme applies a hue across the background layers of the product which gives the product a
strong color identity. The default Viewer theme uses this approach with blue.
</p>
<ul className="mb-4 list-disc pl-6">
<li className="mb-2">All three background layers work within the theme&apos;s color hue</li>
<li className="mb-2">Different hues can be used in place of the Viewer&apos;s default blue</li>
<li className="mb-2">A tonal theme does not need to match the saturation of the default, see examples</li>
<li className="mb-2">Use this approach if you like the general feel of the Viewer, but want it to be more unique</li>
</ul>
</div>
{/* Tonal theme grid */}
<div className="my-9 mb-8 grid items-center gap-x-2.5 gap-y-2.5" style={{ gridTemplateColumns: '82px 59px 59px auto auto auto' }}>
<span className="pb-1.5 text-[11px] font-normal text-[#555]">Backgrounds</span>
<span className="pb-1.5 text-[11px] font-normal text-[#555]">Text</span>
<span className="pb-1.5 text-[11px] font-normal text-[#555]">Interactive</span>
<span className="pb-1.5 pl-3.5 text-[11px] font-normal text-[#555]">Theme name</span>
<span></span>
<span></span>
<ThemeRow
backgrounds={['hsl(0, 0%, 0%)', 'hsl(234, 64%, 10%)', 'hsl(219, 90%, 15%)']}
text={['hsl(200, 46%, 65%)', 'hsl(0, 0%, 98%)']}
interactive={['hsl(214, 98%, 60%)', 'hsl(191, 74%, 63%)']}
name="Default Blue"
previewUrl={BASE_VIEWER + 'default'}
themeName="default"
/>
<ThemeRow
backgrounds={['hsl(270, 45%, 6%)', 'hsl(268, 40%, 10%)', 'hsl(264, 48%, 13%)']}
text={['hsl(272, 30%, 60%)', 'hsl(280, 15%, 96%)']}
interactive={['hsl(270, 85%, 65%)', 'hsl(292, 75%, 62%)']}
name="Orchid"
previewUrl={BASE_VIEWER + 'orchid'}
themeName="orchid"
/>
<ThemeRow
backgrounds={['hsl(155, 40%, 5%)', 'hsl(152, 35%, 9%)', 'hsl(167, 65%, 10%)']}
text={['hsl(148, 25%, 55%)', 'hsl(140, 15%, 95%)']}
interactive={['hsl(152, 75%, 40%)', 'hsl(152, 79%, 52%)']}
name="Verdant"
previewUrl={BASE_VIEWER + 'verdant'}
themeName="verdant"
/>
<ThemeRow
backgrounds={['hsl(0, 0%, 0%)', 'hsl(203, 39%, 9%)', 'hsl(202, 54%, 11%)']}
text={['hsl(185, 30%, 60%)', 'hsl(180, 10%, 97%)']}
interactive={['hsl(175, 85%, 42%)', 'hsl(173, 81%, 52%)']}
name="Arctic"
previewUrl={BASE_VIEWER + 'arctic'}
themeName="arctic"
/>
</div>
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Approach 2: Neutral</h3>
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
A neutral theme still keeps the full color system in place, but reduces the reliance on color in backgrounds.
</p>
<ul className="mb-4 list-disc pl-6">
<li className="mb-2">All three background layers are more neutral and are more subtle in their differences</li>
<li className="mb-2">A more unique primary can be chosen if background colors are more similar</li>
<li className="mb-2">Brand color can be emphasized in detailed accents rather than color fills</li>
<li className="mb-2">This approach reduces the focus on color to emphasize image content</li>
<li className="mb-2">Accessibility can be simpler, but testing is still recommended</li>
</ul>
</div>
{/* Neutral theme grid */}
<div className="my-9 mb-8 grid items-center gap-x-2.5 gap-y-2.5" style={{ gridTemplateColumns: '82px 59px 59px auto auto auto' }}>
<span className="pb-1.5 text-[11px] font-normal text-[#555]">Backgrounds</span>
<span className="pb-1.5 text-[11px] font-normal text-[#555]">Text</span>
<span className="pb-1.5 text-[11px] font-normal text-[#555]">Interactive</span>
<span className="pb-1.5 pl-3.5 text-[11px] font-normal text-[#555]">Theme name</span>
<span></span>
<span></span>
<ThemeRow
backgrounds={['hsl(240, 15%, 3%)', 'hsl(240, 12%, 8%)', 'hsl(225, 45%, 13%)']}
text={['hsl(210, 40%, 70%)', 'hsl(0, 0%, 99%)']}
interactive={['hsl(210, 100%, 62%)', 'hsl(188, 90%, 58%)']}
name="Midnight"
previewUrl={BASE_VIEWER + 'midnight'}
themeName="midnight"
/>
<ThemeRow
backgrounds={['hsl(0, 0%, 0%)', 'hsl(0, 0%, 7%)', 'hsl(0, 0%, 9%)']}
text={['hsl(0, 0%, 60%)', 'hsl(0, 0%, 96%)']}
interactive={['hsl(230, 75%, 55%)', 'hsl(217, 97%, 52%)']}
name="Slate"
previewUrl={BASE_VIEWER + 'slate'}
themeName="slate"
/>
<ThemeRow
backgrounds={['hsl(0, 0%, 0%)', 'hsl(214, 28%, 5%)', 'hsl(215, 30%, 8%)']}
text={['hsl(215, 18%, 48%)', 'hsl(215, 15%, 82%)']}
interactive={['hsl(200, 43%, 48%)', 'hsl(184, 53%, 54%)']}
name="Deep"
previewUrl={BASE_VIEWER + 'deep'}
themeName="deep"
/>
</div>
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Approach 3: Custom</h3>
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
Themes do not need to follow any of these models and more unique combinations can be
considered by following the core color rules and product principles:
</p>
<ul className="mb-4 list-disc pl-6">
<li className="mb-2">Three levels of background are separated enough</li>
<li className="mb-2">Primary serves its purpose to show to users what can be interacted with</li>
<li className="mb-2">Colors are <a href="#accessibility" className="text-primary no-underline hover:underline">accessible</a> in all content scenarios</li>
</ul>
<p>
Theming is flexible enough to support any direction, as long as the colors still work in the product.
</p>
</div>
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">Experiment with the Color Tool</h3>
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
We built a small public web tool that edits the color tokens directly, so you can experiment with
colors and see the results instantly. When a combination looks right, use its{' '}
<strong className="text-foreground">Copy Theme</strong> button and paste the result into the
Custom Theme field in the Viewer&rsquo;s Appearance dialog (see{' '}
<a href="#testing-themes" className="text-primary no-underline hover:underline">Testing Themes</a>) &mdash; an easy
way to iterate quickly and find what works best. The tool is optional; you can also edit tokens by hand.
</p>
<p>
<a
href="https://ohif-theming-beta.netlify.app/"
target="_blank"
rel="noopener noreferrer"
className="text-primary no-underline hover:underline"
>
Open the color tool &rarr;
</a>
</p>
</div>
<h3 id="testing-themes" className="mt-12 mb-4 scroll-mt-20 text-[22px] font-normal text-foreground">
Testing Themes in the Viewer
</h3>
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
You can preview a theme without writing any code using the{' '}
<strong className="text-foreground">Custom Theme</strong> option in the Appearance dialog
(settings menu in the main header) &mdash; useful while designing a theme around the approaches above.
</p>
<img
src="/img/theming-dialog-02-default.png"
alt="Appearance modal showing the Custom Theme button below the Theme dropdown"
className="my-4 mb-6 w-full rounded-lg border border-[#222]"
/>
<p>
The <strong className="text-foreground">Custom Theme</strong> option opens a text field where
you paste CSS color tokens and press <strong className="text-foreground">Apply</strong> to see
them right away. <strong className="text-foreground">Clear</strong> removes them and returns to
the default. A pasted theme is remembered across page reloads.
</p>
<img
src="/img/theming-dialog-03-custom.png"
alt="Custom theme text field for pasting color tokens, with Apply and Clear buttons"
className="my-4 mb-6 w-full rounded-lg border border-[#222]"
/>
</div>
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">For Developers: Adding a New Preset</h3>
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
A preset lives in two places. The <strong className="text-foreground">CSS block is what actually renders</strong>;
the JSON only registers the preset so it appears in the dropdown.
</p>
<ul className="mb-4 list-disc pl-6">
<li className="mb-2">
<strong className="text-foreground">themes.css</strong> &mdash; add a{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">.theme-&#123;name&#125;</code>{' '}
block to <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">platform/ui-next/src/themes/themes.css</code>{' '}
with the full token set. This is the source of truth for the theme&rsquo;s colors.
</li>
<li className="mb-2">
<strong className="text-foreground">&#123;name&#125;.json</strong> &mdash; create{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">platform/ui-next/src/themes/&#123;name&#125;.json</code>{' '}
providing <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">name</code> and{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">label</code> (the dropdown entry).
Its <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">cssVars.dark</code> values
are <strong className="text-foreground">not read at runtime</strong> &mdash; only{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">name</code> and{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">label</code> are used &mdash;
so the <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">.theme-&#123;name&#125;</code>{' '}
CSS block above is what takes effect.
</li>
<li className="mb-2">
<strong className="text-foreground">index.ts</strong> &mdash; import the JSON in{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">platform/ui-next/src/themes/index.ts</code>{' '}
and add it to the <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">themePresets</code> array.
</li>
</ul>
<p>
The dropdown, persistence, and theme switching then work automatically. The JSON{' '}
<code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">name</code> field must match the
CSS class suffix (e.g. <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">&quot;name&quot;: &quot;orchid&quot;</code>{' '}
&harr; <code className="rounded bg-[#111] px-1.5 py-0.5 text-sm text-[#7cacf8]">.theme-orchid</code>).
</p>
</div>
</Section>
{/* ================================ */}
{/* ACCESSIBILITY */}
{/* ================================ */}
<Section title="Accessibility">
<div className="text-secondary-foreground space-y-4 text-lg leading-relaxed">
<p>
The OHIF Viewer is a medical imaging product. The interface supports clinicians and other
professionals working and reading images. Colors in theming should never get in the way.
A theme needs to remain accessible with color contrast and other accessibility standards.
</p>
<p>
The default OHIF theme has been tested and works out of the box to meet these standards.
</p>
<p>
Color contrast must meet{' '}
<a
href="https://www.w3.org/WAI/WCAG21/Understanding/contrast-minimum.html"
target="_blank"
rel="noopener noreferrer"
className="text-primary no-underline hover:underline"
>
WCAG 2.1 Success Criterion 1.4.3 Contrast (Minimum), Level AA
</a>
: text needs a contrast ratio of at least <strong className="text-foreground">4.5:1</strong> against
its background (<strong className="text-foreground">3:1</strong> for large text &mdash; 24px, or 18.66px bold).
</p>
<p>
The pairs below show the <strong className="text-foreground">default OHIF theme</strong> and how its
colors meet the contrast requirements. The <strong className="text-foreground">Result</strong> column
is each pair&apos;s actual contrast ratio, and the <strong className="text-foreground">Guidance</strong>{' '}
column is the minimum it must meet. When creating your own theme, check every foreground against each
background layer it can appear on.
</p>
</div>
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">
Test Primary Across All Three Background Colors
</h3>
<p className="text-secondary-foreground mb-4 text-lg">
The most important color that shows content that can be interactive needs to be tested across
all three background layers.
</p>
<ContrastTable rows={[
{ fgLabel: 'primary', fgColor: 'hsl(214, 98%, 60%)', bgLabel: 'background', bgColor: 'hsl(0, 0%, 0%)', result: '6.3:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'primary', fgColor: 'hsl(214, 98%, 60%)', bgLabel: 'muted', bgColor: 'hsl(234, 64%, 10%)', result: '5.7:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'primary', fgColor: 'hsl(214, 98%, 60%)', bgLabel: 'popover', bgColor: 'hsl(219, 90%, 15%)', result: '5.0:1', requirement: '≥ 4.5:1' },
]} />
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">
Test Text Content Across All Three Background Colors
</h3>
<p className="text-secondary-foreground mb-4 text-lg">
Text appears on each background layer. Be sure to test each to ensure readability.
</p>
<ContrastTable rows={[
{ fgLabel: 'foreground', fgColor: 'hsl(0, 0%, 98%)', bgLabel: 'background', bgColor: 'hsl(0, 0%, 0%)', result: '20.1:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'foreground', fgColor: 'hsl(0, 0%, 98%)', bgLabel: 'muted', bgColor: 'hsl(234, 64%, 10%)', result: '18.3:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'foreground', fgColor: 'hsl(0, 0%, 98%)', bgLabel: 'popover', bgColor: 'hsl(219, 90%, 15%)', result: '15.9:1', requirement: '≥ 4.5:1' },
]} />
<ContrastTable rows={[
{ fgLabel: 'muted-foreground', fgColor: 'hsl(200, 46%, 65%)', bgLabel: 'background', bgColor: 'hsl(0, 0%, 0%)', result: '9.2:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'muted-foreground', fgColor: 'hsl(200, 46%, 65%)', bgLabel: 'muted', bgColor: 'hsl(234, 64%, 10%)', result: '8.4:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'muted-foreground', fgColor: 'hsl(200, 46%, 65%)', bgLabel: 'popover', bgColor: 'hsl(219, 90%, 15%)', result: '7.3:1', requirement: '≥ 4.5:1' },
]} />
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">
Test Viewport Text If You Change It
</h3>
<p className="text-secondary-foreground mb-4 text-lg">
Be sure to test the viewport neutral text over standard viewport backgrounds, but increase
the contrast here as much as possible since text needs to remain readable over various image content.
</p>
<ContrastTable rows={[
{ fgLabel: 'neutral-light', fgColor: 'hsl(214, 69%, 81%)', bgLabel: '#000000', bgColor: '#000000', result: '12.5:1', requirement: '≥ 4.5:1 (aim higher)' },
{ fgLabel: 'neutral-dark', fgColor: 'hsl(214, 16%, 21%)', bgLabel: '#FFFFFF', bgColor: '#ffffff', result: '12.5:1', requirement: '≥ 4.5:1 (aim higher)' },
]} />
<h3 className="mt-12 mb-4 text-[22px] font-normal text-foreground">
Test Foreground Colors Over Their Backgrounds
</h3>
<ContrastTable rows={[
{ fgLabel: 'foreground', fgColor: 'hsl(0, 0%, 98%)', bgLabel: 'primary/80', bgColor: 'hsla(214, 98%, 60%, 0.8)', result: '4.7:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'secondary-foreground', fgColor: 'hsl(200, 50%, 84%)', bgLabel: 'secondary', bgColor: 'hsl(214, 65%, 36%)', result: '5.3:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'accent-foreground', fgColor: 'hsl(0, 0%, 98%)', bgLabel: 'accent', bgColor: 'hsl(217, 79%, 24%)', result: '11.9:1', requirement: '≥ 4.5:1' },
{ fgLabel: 'destructive-foreground', fgColor: 'hsl(0, 0%, 98%)', bgLabel: 'destructive', bgColor: 'hsl(0, 62.8%, 30.6%)', result: '9.6:1', requirement: '≥ 4.5:1' },
]} />
</Section>
</ComponentLayout>
);
}
export default function ThemingPage() {
return (
<BrowserOnly fallback={<></>}>{() => <ThemingPageContent />}</BrowserOnly>
);
}
-434
View File
@@ -1,434 +0,0 @@
import React, { useState } from 'react';
import '../css/custom.css';
import Layout from '@theme/Layout';
import { Label } from '../../../ui-next/src/components/Label';
import { Input } from '../../../ui-next/src/components/Input';
import { Separator } from '../../../ui-next/src/components/Separator';
import { Tabs, TabsList, TabsTrigger } from '../../../ui-next/src/components/Tabs';
import {
Select,
SelectTrigger,
SelectContent,
SelectItem,
SelectValue,
} from '../../../ui-next/src/components/Select';
import { Button } from '../../../ui-next/src/components/Button';
import { Switch } from '../../../ui-next/src/components/Switch';
import { Checkbox } from '../../../ui-next/src/components/Checkbox';
import { Toggle } from '../../../ui-next/src/components/Toggle';
import { Slider } from '../../../ui-next/src/components/Slider';
import { ScrollArea } from '../../../ui-next/src/components/ScrollArea';
import {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
} from '../../../ui-next/src/components/DropdownMenu';
import { Icons } from '../../../ui-next/src/components/Icons';
import { Toaster, toast } from '../../../ui-next/src/components/Sonner';
import {
Card,
CardHeader,
CardFooter,
CardTitle,
CardDescription,
CardContent,
} from '../../../ui-next/src/components/Card';
interface ShowcaseRowProps {
title: string;
description?: string;
children: React.ReactNode;
code: string;
}
export default function ComponentShowcase() {
// Handlers to trigger different types of toasts
const triggerSuccess = () => {
toast.success('This is a success toast!');
};
const triggerError = () => {
toast.error('This is an error toast!');
};
const triggerInfo = () => {
toast.info('This is an info toast!');
};
const triggerWarning = () => {
toast.warning('This is a warning toast!');
};
// Handler to trigger a toast.promise example
const triggerPromiseToast = () => {
const promise = () =>
new Promise<{ name: string }>(resolve =>
setTimeout(() => resolve({ name: 'Segmentation 1' }), 3000)
);
toast.promise(promise(), {
loading: 'Loading Segmentation...',
success: data => `${data.name} has been added`,
error: 'Error',
});
};
// Handler to trigger a toast with description
const triggerDescriptionToast = () => {
toast.success('Success heading', {
description: 'This is a detailed description of the success message.',
});
};
// Handler to trigger a toast with an action button
const triggerActionButtonToast = () => {
toast.info('No active segmentation detected', {
description: 'Create a segmentation before using the Brush',
});
};
// Handler to trigger a toast with a cancel button
const triggerCancelButtonToast = () => {
toast.error('No active segmentation detected', {
description: 'Create a segmentation before using the Brush',
});
};
// Handler to trigger a toast with both action and cancel buttons
const triggerCombinedToast = () => {
toast.warning('Warning!', {
description: 'This is a warning with both action and cancel buttons.',
action: (
<Button
size="sm"
variant="ghost"
onClick={() => alert('Retry action clicked')}
>
Retry
</Button>
),
cancel: (
<Button
size="sm"
variant="ghost"
onClick={() => toast.dismiss()}
>
Cancel
</Button>
),
});
};
// Handler to trigger a loading toast using Toaster's default loading icon
const showLoadingToast = () => {
toast.loading('Loading your data...');
};
return (
<Layout
title="Colors and Typography"
description="Colors and Typography"
>
<div className="text-foreground min-h-screen bg-background">
<div className="mx-auto my-4 max-w-5xl pt-4 pb-6">
{/* Navigation cards */}
<div className="mb-8 grid grid-cols-1 gap-5 md:grid-cols-3">
<a
href="/colors-and-type"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Colors & Typography
</CardTitle>
<CardDescription className="text-lg">
Color Palette and Typography Guidelines
</CardDescription>
</CardHeader>
</Card>
</a>
<a
href="/components-list"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Components
</CardTitle>
<CardDescription className="text-lg">
Essential UI Components with Variants
</CardDescription>
</CardHeader>
</Card>
</a>
<a
href="/patterns"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Patterns
</CardTitle>
<CardDescription className="text-lg">
Component-Based Layout Examples
</CardDescription>
</CardHeader>
</Card>
</a>
</div>
<h1 className="text-foreground ml-6 mb-6 text-5xl">Colors & Typography</h1>
<ShowcaseRow
title="Colors"
description="Updated color variables for new components."
code={`Code Example Coming Soon`}
>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3">
<div className="bg-highlight h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">highlight</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-1.5 text-lg">
Used for active or selected elements in the Viewer.
</div>
</div>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3">
<div className="bg-primary h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">primary</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-1.5 text-lg">
Used for Actions. Icons use 'primary' at 100% opacity while various components will
use a reduced opacity. Hover and other states increase the opacity.
</div>
</div>
<div className="mb-8 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3">
<div className="bg-popover h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">popover</span>
</div>
<div className="flex items-center space-x-3">
<div className="bg-muted h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">muted</span>
</div>
<div className="flex items-center space-x-3">
<div className="bg-background border-input h-[30px] w-[30px] rounded border"></div>
<span className="text-foreground text-lg">background</span>
</div>
</div>
<div className="text-secondary-foreground flex items-center pt-1.5 text-lg">
These three colors are used as background colors. For the lowest level above black
use 'background'. For normal panel backgrounds and other interactive components, use
'muted'. For elements such as menus and popovers, use 'popover'.
</div>
</div>
<div className="mb-8 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3">
<div className="bg-foreground h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">foreground</span>
</div>
<div className="flex items-center space-x-3">
<div className="bg-muted-foreground h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">muted-foreground</span>
</div>
</div>
<div className="text-secondary-foreground flex items-center pt-1.5 text-lg">
For primary and important text, use 'foreground'. When secondary text is available,
use 'muted-foreground' to create separation and readability.
</div>
</div>
<div className="mb-8 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3">
<div className="bg-input h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">input</span>
</div>
<div className="flex items-center space-x-3">
<div className="bg-neutral h-[30px] w-[30px] rounded"></div>
<span className="text-foreground text-lg">neutral</span>
</div>
</div>
<div className="text-secondary-foreground flex items-center pt-1.5 text-lg">
Used for borders and UI elements. 'neutral' is typically used at 50% opacity for
elements such as scrollbars and will work over light and dark backgrounds
</div>
</div>
</ShowcaseRow>
<ShowcaseRow
title="Typography"
description="Type variables and guidelines"
code={`
Code example coming soon
`}
>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3 text-base">
<span className="text-foreground">text-base</span>
<span className="text-muted-foreground">13px</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-0 text-lg">
text-base is used as the base font size of the Viewer interface. Use when putting
text in panels or other interface elements next to medical images.
</div>
</div>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3 text-lg">
<span className="text-foreground">text-lg</span>
<span className="text-muted-foreground">14px</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-0 text-lg">
text-lg can be used for dialog text or important messaging text within the Viewer.
Use this font size for easier reading on other standard text pages.
</div>
</div>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3 text-xl">
<span className="text-foreground">text-xl</span>
<span className="text-muted-foreground">16px</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-0 text-lg">
text-xl can be used as headings within dialogs or messaging.
</div>
</div>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3 text-2xl">
<span className="text-foreground">text-2xl</span>
<span className="text-muted-foreground">18px</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-0 text-lg">
text-2xl can be used for page headers in the Viewer application or as dialog titles.
</div>
</div>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3 text-3xl">
<span className="text-foreground">text-3xl</span>
<span className="text-muted-foreground">20px</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-0 text-lg">
text-3xl can be used for extra large text size in the application.
</div>
</div>
<div className="mb-6 grid grid-cols-[28%,1fr] items-start gap-x-8">
<div className="space-y-2.5">
<div className="flex items-center space-x-3 text-sm">
<span className="text-foreground">text-sm</span>
<span className="text-muted-foreground">12px</span>
</div>
<div className="flex items-center space-x-3"></div>
</div>
<div className="text-secondary-foreground flex items-center pt-0 text-lg">
text-sm can be used for details that do not need to be standard sizes in the Viewer.
</div>
</div>
</ShowcaseRow>
</div>
</div>
</Layout>
);
}
function ShowcaseRow({ title, description, children, code }: ShowcaseRowProps) {
const [showCode, setShowCode] = useState(false);
return (
<div className="bg-background mb-8 rounded-lg p-6">
<div className="mb-4 flex items-start justify-between">
<div>
<h2 className="text-highlight text-2xl">{title}</h2>
</div>
<Button
className="text-primary"
variant="ghost"
size="sm"
onClick={() => setShowCode(!showCode)}
>
{showCode ? 'Hide Code' : 'Show Code'} <Icons.Code className="ml-2 h-4 w-4" />
</Button>
</div>
<div className="grid grid-cols-1 gap-9 md:grid-cols-3">
<div className="text-lg md:col-span-1">
{description && <p className="text-secondary-foreground mt-2">{description}</p>}
</div>
<div className="flex min-h-[120px] items-center md:col-span-2">
<div className="showcase-content">{children}</div>
</div>
</div>
{showCode && (
<pre className="border-input mt-4 overflow-x-auto rounded-md border bg-background p-4 text-sm">
<code>{code}</code>
</pre>
)}
</div>
);
}
// function ShowcaseRow({ title, description, children, code }: ShowcaseRowProps) {
// const [showCode, setShowCode] = useState(false);
// return (
// <div className="bg-background mb-8 rounded-lg p-6">
// <div className="mb-4 flex items-start justify-between">
// <div>
// <h2 className="text-2xl font-bold">{title}</h2>
// {description && <p className="text-secondary-foreground mt-1">{description}</p>}
// </div>
// <Button
// className="text-primary"
// variant="outline"
// size="sm"
// onClick={() => setShowCode(!showCode)}
// >
// {showCode ? 'Hide Code' : 'Show Code'} <Icons.Code className="ml-2 h-4 w-4" />
// </Button>
// </div>
// <div className="showcase-content mb-4">{children}</div>
// {showCode && (
// <pre className="mt-4 overflow-x-auto rounded-md bg-background p-4 text-sm">
// <code>{code}</code>
// </pre>
// )}
// </div>
// );
// }
-142
View File
@@ -1,142 +0,0 @@
import React from 'react';
import '../css/custom.css';
import Layout from '@theme/Layout';
import BrowserOnly from '@docusaurus/BrowserOnly';
/**
* Components List page that displays all available UI components
*/
export default function ComponentsList() {
return (
<Layout title="Components" description="OHIF Viewer Components">
<BrowserOnly fallback={<></>}>
{() => {
// Dynamically require all sub-components to avoid SSR issues
const { TooltipProvider } =
require('../../../ui-next/src/components/Tooltip');
const {
Card,
CardHeader,
CardTitle,
CardDescription,
} = require('../../../ui-next/src/components/Card');
const { Icons } = require('../../../ui-next/src/components/Icons');
// Showcase modules
const AllinOneMenuShowcase = require('./components/AllinOneMenuShowcase').default;
const ButtonShowcase = require('./components/ButtonShowcase').default;
const CheckboxShowcase = require('./components/CheckboxShowcase').default;
const CinePlayerShowcase = require('./components/CinePlayerShowcase').default;
const ComboboxShowcase = require('./components/ComboboxShowcase').default;
const DataRowShowcase = require('./components/DataRowShowcase').default;
const DialogShowcase = require('./components/DialogShowcase').default;
const DropdownMenuShowcase = require('./components/DropdownMenuShowcase').default;
const HoverCardShowcase = require('./components/HoverCardShowcase').default;
const InputShowcase = require('./components/InputShowcase').default;
const LabelShowcase = require('./components/LabelShowcase').default;
const NumericMetaShowcase = require('./components/NumericMetaShowcase').default;
const PanelSectionShowcase = require('./components/PanelSectionShowcase').default;
const PopoverShowcase = require('./components/PopoverShowcase').default;
const ScrollAreaShowcase = require('./components/ScrollAreaShowcase').default;
const SelectShowcase = require('./components/SelectShowcase').default;
const SliderShowcase = require('./components/SliderShowcase').default;
const SwitchShowcase = require('./components/SwitchShowcase').default;
const TabsShowcase = require('./components/TabsShowcase').default;
const ToastShowcase = require('./components/ToastShowcase').default;
const ToolButtonShowcase = require('./components/ToolButtonShowcase').default;
const ToolButtonListShowcase = require('./components/ToolButtonListShowcase').default;
const TooltipShowcase = require('./components/TooltipShowcase').default;
return (
<TooltipProvider>
<div className="text-foreground min-h-screen bg-background">
<div className="mx-auto my-4 max-w-5xl pt-4 pb-6">
{/* Navigation cards */}
<div className="mb-8 grid grid-cols-1 gap-5 md:grid-cols-3">
<a
href="/colors-and-type"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Colors &amp; Typography
</CardTitle>
<CardDescription className="text-lg">
Color Palette and Typography Guidelines
</CardDescription>
</CardHeader>
</Card>
</a>
<a
href="/components-list"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Components
</CardTitle>
<CardDescription className="text-lg">
Essential UI Components with Variants
</CardDescription>
</CardHeader>
</Card>
</a>
<a
href="/patterns"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Patterns
</CardTitle>
<CardDescription className="text-lg">
Component‑Based Layout Examples
</CardDescription>
</CardHeader>
</Card>
</a>
</div>
<h1 className="text-foreground ml-6 mb-6 text-5xl">
Components
</h1>
<AllinOneMenuShowcase />
<ButtonShowcase />
<CheckboxShowcase />
<CinePlayerShowcase />
<ComboboxShowcase />
<DataRowShowcase />
<DialogShowcase />
<DropdownMenuShowcase />
<HoverCardShowcase />
<InputShowcase />
<LabelShowcase />
<NumericMetaShowcase />
<PanelSectionShowcase />
<PopoverShowcase />
<ScrollAreaShowcase />
<SelectShowcase />
<SliderShowcase />
<SwitchShowcase />
<TabsShowcase />
<ToastShowcase />
<ToolButtonShowcase />
<ToolButtonListShowcase />
<TooltipShowcase />
</div>
</div>
</TooltipProvider>
);
}}
</BrowserOnly>
</Layout>
);
}
-265
View File
@@ -1,265 +0,0 @@
import React, { useState } from 'react';
import '../css/custom.css';
import Layout from '@theme/Layout';
import { Label } from '../../../ui-next/src/components/Label';
import { Input } from '../../../ui-next/src/components/Input';
import { Separator } from '../../../ui-next/src/components/Separator';
import { Tabs, TabsList, TabsTrigger } from '../../../ui-next/src/components/Tabs';
import {
Select,
SelectTrigger,
SelectContent,
SelectItem,
SelectValue,
} from '../../../ui-next/src/components/Select';
import { Button } from '../../../ui-next/src/components/Button';
import { Switch } from '../../../ui-next/src/components/Switch';
import { Checkbox } from '../../../ui-next/src/components/Checkbox';
import { Toggle } from '../../../ui-next/src/components/Toggle';
import { Slider } from '../../../ui-next/src/components/Slider';
import { ScrollArea } from '../../../ui-next/src/components/ScrollArea';
import {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
} from '../../../ui-next/src/components/DropdownMenu';
import { Icons } from '../../../ui-next/src/components/Icons';
import { Toaster, toast } from '../../../ui-next/src/components/Sonner';
import {
Card,
CardHeader,
CardFooter,
CardTitle,
CardDescription,
CardContent,
} from '../../../ui-next/src/components/Card';
interface ShowcaseRowProps {
title: string;
description?: string;
children: React.ReactNode;
code: string;
}
export default function ComponentShowcase() {
// Handlers to trigger different types of toasts
const triggerSuccess = () => {
toast.success('This is a success toast!');
};
const triggerError = () => {
toast.error('This is an error toast!');
};
const triggerInfo = () => {
toast.info('This is an info toast!');
};
const triggerWarning = () => {
toast.warning('This is a warning toast!');
};
// Handler to trigger a toast.promise example
const triggerPromiseToast = () => {
const promise = () =>
new Promise<{ name: string }>(resolve =>
setTimeout(() => resolve({ name: 'Segmentation 1' }), 3000)
);
toast.promise(promise(), {
loading: 'Loading Segmentation...',
success: data => `${data.name} has been added`,
error: 'Error',
});
};
// Handler to trigger a toast with description
const triggerDescriptionToast = () => {
toast.success('Success heading', {
description: 'This is a detailed description of the success message.',
});
};
// Handler to trigger a toast with an action button
const triggerActionButtonToast = () => {
toast.info('No active segmentation detected', {
description: 'Create a segmentation before using the Brush',
});
};
// Handler to trigger a toast with a cancel button
const triggerCancelButtonToast = () => {
toast.error('No active segmentation detected', {
description: 'Create a segmentation before using the Brush',
});
};
// Handler to trigger a toast with both action and cancel buttons
const triggerCombinedToast = () => {
toast.warning('Warning!', {
description: 'This is a warning with both action and cancel buttons.',
action: (
<Button
size="sm"
variant="ghost"
onClick={() => alert('Retry action clicked')}
>
Retry
</Button>
),
cancel: (
<Button
size="sm"
variant="ghost"
onClick={() => toast.dismiss()}
>
Cancel
</Button>
),
});
};
// Handler to trigger a loading toast using Toaster's default loading icon
const showLoadingToast = () => {
toast.loading('Loading your data...');
};
return (
<Layout
title="OHIF Viewer Design System"
description="OHIF Viewer Design System"
>
<div className="text-foreground min-h-screen bg-background">
<div className="mx-auto my-4 max-w-5xl pt-6 pb-3">
<div className="grid grid-cols-1 gap-5 md:grid-cols-3">
<a
href="/colors-and-type"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Colors & Typography
</CardTitle>
<CardDescription className="text-lg">
Color Palette and Typography Guidelines
</CardDescription>
</CardHeader>
</Card>
</a>
<a
href="/components-list"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Components
</CardTitle>
<CardDescription className="text-lg">
Essential UI Components with Variants
</CardDescription>
</CardHeader>
</Card>
</a>
<a
href="/patterns"
className="focus:ring-primary block rounded-lg text-inherit no-underline hover:no-underline focus:outline-none focus:ring-2"
>
<Card className="hover:bg-primary/30 w-full transition-colors">
<CardHeader>
<CardTitle className="text-foreground text-xl">
<Icons.ColorChange className="h-12 w-12" />
Patterns
</CardTitle>
<CardDescription className="text-lg">
Component-Based Layout Examples
</CardDescription>
</CardHeader>
</Card>
</a>
</div>
<div className="mt-12">
<div className="text-md mx-auto max-w-2xl"></div>
</div>
</div>
</div>
</Layout>
);
}
function ShowcaseRow({ title, description, children, code }: ShowcaseRowProps) {
const [showCode, setShowCode] = useState(false);
return (
<div className="bg-background mb-8 rounded-lg p-6">
{/* Header Section */}
<div className="mb-4 flex items-start justify-between">
<div>
<h2 className="text-foreground text-2xl">{title}</h2>
</div>
<Button
className="text-primary"
variant="ghost"
size="sm"
onClick={() => setShowCode(!showCode)}
>
{showCode ? 'Hide Code' : 'Show Code'} <Icons.Code className="ml-2 h-4 w-4" />
</Button>
</div>
{/* Content Section: 1/3 Left, 2/3 Right */}
<div className="grid grid-cols-1 gap-9 md:grid-cols-3">
{/* Left Side: Title and Description */}
<div className="text-lg md:col-span-1">
{description && <p className="text-muted-foreground mt-2">{description}</p>}
</div>
{/* Right Side: Example */}
<div className="flex min-h-[120px] items-center md:col-span-2">
<div className="showcase-content">{children}</div>
</div>
</div>
{/* Code Section */}
{showCode && (
<pre className="mt-4 overflow-x-auto rounded-md bg-background p-4 text-sm">
<code>{code}</code>
</pre>
)}
</div>
);
}
// function ShowcaseRow({ title, description, children, code }: ShowcaseRowProps) {
// const [showCode, setShowCode] = useState(false);
// return (
// <div className="bg-background mb-8 rounded-lg p-6">
// <div className="mb-4 flex items-start justify-between">
// <div>
// <h2 className="text-2xl font-bold">{title}</h2>
// {description && <p className="text-muted-foreground mt-1">{description}</p>}
// </div>
// <Button
// className="text-primary"
// variant="outline"
// size="sm"
// onClick={() => setShowCode(!showCode)}
// >
// {showCode ? 'Hide Code' : 'Show Code'} <Icons.Code className="ml-2 h-4 w-4" />
// </Button>
// </div>
// <div className="showcase-content mb-4">{children}</div>
// {showCode && (
// <pre className="mt-4 overflow-x-auto rounded-md bg-background p-4 text-sm">
// <code>{code}</code>
// </pre>
// )}
// </div>
// );
// }
@@ -1,119 +0,0 @@
import React from 'react';
import useIsBrowser from '@docusaurus/useIsBrowser';
import ShowcaseRow from './ShowcaseRow';
/**
* Pure‑UI mock of the in‑app Window/Level menu.
* Clickable, but all actions are inert.
*/
export default function AllinOneMenuShowcase() {
const isBrowser = useIsBrowser();
if (!isBrowser) {
return null;
}
const {
default: AllInOneMenu,
IconMenu,
SubMenu,
ItemPanel,
Item,
DividerItem,
HorizontalDirection,
VerticalDirection,
} = require('../../../../ui-next/src/components/AllInOneMenu');
const { Switch } = require('../../../../ui-next/src/components/Switch');
const renderColorLUTItems = () =>
[
'Grayscale',
'X Ray',
'HSV',
'Hot Iron',
'Red Hot',
'S PET',
'Perfusion',
'Rainbow',
'SUV',
'GE 256',
'GE',
'Siemens',
].map(name => <Item key={name} label={name} />);
const renderWindowPresetItems = () =>
[
{ desc: 'Soft tissue', wl: '400 / 40' },
{ desc: 'Lung', wl: '1500 / -600' },
{ desc: 'Liver', wl: '150 / 90' },
{ desc: 'Bone', wl: '2500 / 480' },
{ desc: 'Brain', wl: '80 / 40' },
].map(p => (
<Item key={p.desc} label={p.desc} secondaryLabel={p.wl} />
));
return (
<ShowcaseRow
title="All In One Menu"
description="A structured menu that consolidates controls and actions."
code={`<IconMenu icon="viewport-window-level" menuStyle={{ width: 212, maxHeight: 500 }}>…</IconMenu>`}
>
<div className="border-input/70 relative flex h-12 items-center rounded border bg-background px-4">
<IconMenu
icon="viewport-window-level"
iconClassName="text-xl text-highlight hover:bg-primary/30 cursor-pointer rounded"
horizontalDirection={HorizontalDirection.LeftToRight}
verticalDirection={VerticalDirection.TopToBottom}
menuStyle={{ width: 212, maxHeight: 500 }}
>
<ItemPanel label="Display">
<Item
label="Display Color bar"
rightIcon={
<Switch
checked={false}
disabled
className="pointer-events-none"
/>
}
useIconSpace={false}
/>
<DividerItem />
<SubMenu itemLabel="Color LUT" itemIcon="icon-color-lut">
<ItemPanel
label="Color LUTs"
maxHeight="calc(100vh - 250px)"
className="flex flex-col"
>
<Item
label="Preview in viewport"
rightIcon={
<Switch
checked={false}
disabled
className="pointer-events-none"
/>
}
/>
<DividerItem />
{renderColorLUTItems()}
</ItemPanel>
</SubMenu>
<SubMenu
itemLabel="Window Presets"
itemIcon="viewport-window-level"
>
<ItemPanel label="CT Presets">
{renderWindowPresetItems()}
</ItemPanel>
</SubMenu>
</ItemPanel>
</IconMenu>
<span className="text-muted-foreground ml-3 text-sm">
Click the icon to explore an example
</span>
</div>
</ShowcaseRow>
);
}
@@ -1,54 +0,0 @@
import React from 'react';
import { Button } from '../../../../ui-next/src/components/Button';
import ShowcaseRow from './ShowcaseRow';
/**
* ButtonShowcase component displays button variants and examples
*/
export default function ButtonShowcase() {
return (
<ShowcaseRow
title="Buttons"
description="Button components and size variants. Use the primary and secondary buttons in dialogs or screens where one action is required. In the Viewer application, use ghost button in panels where many different actions are available."
code={`
<Button variant="default">Primary Button</Button>
<Button variant="secondary">Secondary Button</Button>
<Button variant="ghost">Ghost Button</Button>
<Button variant="ghost" size="icon">?</Button>
<Button variant="link">Link</Button>
`}
>
<div className="flex flex-wrap gap-4">
<Button variant="default">Primary Button</Button>
<Button variant="secondary">Secondary Button</Button>
<Button variant="ghost">Ghost Button</Button>
<Button
variant="ghost"
size="icon"
>
?
</Button>
<Button variant="link">Link</Button>
</div>
<div className="mt-6 flex flex-wrap gap-4">
<Button
variant="default"
size="lg"
className="w-[107px]"
>
Large Button
</Button>
<Button
variant="default"
size="sm"
>
Small Button
</Button>
</div>
</ShowcaseRow>
);
}
@@ -1,31 +0,0 @@
import React from 'react';
import { Checkbox } from '../../../../ui-next/src/components/Checkbox';
import { Label } from '../../../../ui-next/src/components/Label';
import ShowcaseRow from './ShowcaseRow';
/**
* CheckboxShowcase component displays checkbox variants and examples
*/
export default function CheckboxShowcase() {
return (
<ShowcaseRow
title="Checkbox"
description="When possible use Switch in place of checkbox. If necessary, Checkbox provides a smaller component to change between two states or options."
code={`
<div className="items-top flex space-x-2">
<Checkbox id="terms1" />
<div className="grid gap-1.5 pt-0.5 leading-none">
<Label>Display inactive segmentations</Label>
</div>
</div>
`}
>
<div className="items-top flex space-x-2">
<Checkbox id="terms1" />
<div className="grid gap-1.5 pt-0.5 leading-none">
<Label>Display inactive segmentations</Label>
</div>
</div>
</ShowcaseRow>
);
}
@@ -1,45 +0,0 @@
import React, { useState } from 'react';
import useIsBrowser from '@docusaurus/useIsBrowser';
import ShowcaseRow from './ShowcaseRow';
/**
* CinePlayerShowcase displays a playable/pausable cine player with FPS control.
*/
export default function CinePlayerShowcase() {
const [isPlaying, setIsPlaying] = useState(false);
const [fps, setFps] = useState(24);
const isBrowser = useIsBrowser();
// If not browser, return null to avoid SSR parse errors
if (!isBrowser) {
return null;
}
const { default: CinePlayer } = require('../../../../ui-next/src/components/CinePlayer/CinePlayer');
return (
<ShowcaseRow
title="Cine Player"
description="Play, pause, scrub through dynamic image series and adjust FPS."
code={`
<CinePlayer
className="w-[300px]"
isPlaying={isPlaying}
frameRate={fps}
onPlayPauseChange={setIsPlaying}
onFrameRateChange={setFps}
onClose={() => console.log('close clicked')}
/>
`}
>
<CinePlayer
className="w-[300px]"
isPlaying={isPlaying}
frameRate={fps}
onPlayPauseChange={setIsPlaying}
onFrameRateChange={setFps}
onClose={() => console.log('close clicked')}
/>
</ShowcaseRow>
);
}
@@ -1,105 +0,0 @@
import React from 'react';
import { Combobox } from '../../../../ui-next/src/components/Combobox/Combobox';
import ShowcaseRow from './ShowcaseRow';
/**
* ComboboxShowcase demonstrates the searchable Combobox component with a
* comprehensive “Modality” list.
*/
export default function ComboboxShowcase() {
const modalities = [
'AR',
'ASMT',
'AU',
'BDUS',
'BI',
'BMD',
'CR',
'CT',
'CTPROTOCOL',
'DG',
'DOC',
'DX',
'ECG',
'EPS',
'ES',
'FID',
'GM',
'HC',
'HD',
'IO',
'IOL',
'IVOCT',
'IVUS',
'KER',
'KO',
'LEN',
'LS',
'MG',
'MR',
'M3D',
'NM',
'OAM',
'OCT',
'OP',
'OPM',
'OPT',
'OPTBSV',
'OPTENF',
'OPV',
'OSS',
'OT',
'PLAN',
'PR',
'PT',
'PX',
'REG',
'RESP',
'RF',
'RG',
'RTDOSE',
'RTIMAGE',
'RTINTENT',
'RTPLAN',
'RTRAD',
'RTRECORD',
'RTSEGANN',
'RTSTRUCT',
'RWV',
'SEG',
'SM',
'SMR',
'SR',
'SRF',
'STAIN',
'TEXTUREMAP',
'TG',
'US',
'VA',
'XA',
'XC',
].map(m => ({ value: m, label: m }));
return (
<ShowcaseRow
title="Combobox"
description="Searchable dropdown built with Command + Popover primitives."
code={`
const modalities = [
'AR','ASMT','AU','BDUS','BI','BMD','CR','CT','CTPROTOCOL','DG','DOC','DX','ECG','EPS','ES','FID',
'GM','HC','HD','IO','IOL','IVOCT','IVUS','KER','KO','LEN','LS','MG','MR','M3D','NM','OAM','OCT',
'OP','OPM','OPT','OPTBSV','OPTENF','OPV','OSS','OT','PLAN','PR','PT','PX','REG','RESP','RF','RG',
'RTDOSE','RTIMAGE','RTINTENT','RTPLAN','RTRAD','RTRECORD','RTSEGANN','RTSTRUCT','RWV','SEG','SM',
'SMR','SR','SRF','STAIN','TEXTUREMAP','TG','US','VA','XA','XC',
].map(m => ({ value: m, label: m }));
<Combobox data={modalities} placeholder="Modality" />
`}
>
<Combobox
data={modalities}
placeholder="Modality"
/>
</ShowcaseRow>
);
}
@@ -1,20 +0,0 @@
import React from 'react';
import DataRowExample from '../patterns/DataRowExample';
import ShowcaseRow from './ShowcaseRow';
/**
* DataRowShowcase component displays DataRow variants and examples
*/
export default function DataRowShowcase() {
return (
<ShowcaseRow
title="Data Row"
description="A selectable row with action menu options and visibility toggle. Color, Secondary details, and Image Series are optional to display."
code={`
Example code coming soon.
`}
>
<DataRowExample />
</ShowcaseRow>
);
}
@@ -1,82 +0,0 @@
import React from 'react';
import {
Dialog,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
DialogClose,
} from '../../../../ui-next/src/components/Dialog/Dialog';
import { Button } from '../../../../ui-next/src/components/Button';
import ShowcaseRow from './ShowcaseRow';
/**
* DialogShowcase demonstrates a simple Radix‑based dialog.
*/
export default function DialogShowcase() {
return (
<ShowcaseRow
title="Dialog"
description="Modal dialog with header, content, and footer actions."
code={`
<Dialog>
<DialogTrigger asChild>
<Button variant="default">Open Dialog</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Example Dialog</DialogTitle>
</DialogHeader>
<DialogDescription>
This is a short message inside the dialog.
</DialogDescription>
<DialogFooter>
<DialogClose asChild>
<Button variant="secondary" className="min-w-[60px]">Cancel</Button>
</DialogClose>
<DialogClose asChild>
<Button variant="default" className="min-w-[60px]">OK</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
`}
>
<Dialog>
<DialogTrigger asChild>
<Button variant="default">Open Dialog</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Example Dialog</DialogTitle>
</DialogHeader>
<DialogDescription>This is a short message inside the dialog.</DialogDescription>
<DialogFooter>
<DialogClose asChild>
<Button
variant="secondary"
className="min-w-[60px]"
>
Cancel
</Button>
</DialogClose>
<DialogClose asChild>
<Button
variant="default"
className="min-w-[60px]"
>
OK
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
</ShowcaseRow>
);
}
Loaded 100 of 242 files, more files were not shown because too many files have changed in this diff. Show more