import type { CustomButtonConfig } from '../../../../common/src/api/action'; /** * A CSS color value per view tab state. Any omitted state keeps its theme default, so a partial * object overrides only the states it names. * * An empty string means inherit — that state is unset and falls back to its theme default. This is the only * way to remove a color from a view that already has one: `updateOptions` merges, so omitting a state leaves * its current color in place, and an empty `viewTab` object is treated as no change at all. */ export interface ViewTabStateColorOptions { /** Color when the tab is inactive. */ default?: string; /** Color when the tab is hovered (and not active). */ hover?: string; /** Color when the tab is active. */ active?: string; /** Color when the tab is active and its view is focused. */ focus?: string; } export type ViewTabControlPosition = { /** Tab element used as the placement anchor. */ relativeTo: 'title' | 'favicon'; /** Side of the anchor on which the control is placed. */ placement: 'before' | 'after'; }; export type ThemedIcon = { dark: string; light: string; }; export interface ViewTabControl extends Omit { /** Icon URL, or URLs selected according to the current color scheme. */ iconUrl?: string | ThemedIcon; /** Defaults to before the tab title. */ position?: ViewTabControlPosition; } export type ViewTabColorRole = 'backgroundColor' | 'fontColor'; /** * Per-view view-tab appearance settings, nested under `workspacePlatform.viewTab` on view options. * * @example * ```ts * import * as WorkspacePlatform from '@openfin/workspace-platform'; * * const platform = WorkspacePlatform.getCurrentSync(); * await platform.Browser.createView({ * url: 'https://example.com', * workspacePlatform: { * viewTab: { * backgroundColor: { default: '#1e3a5f', active: '#356aa3' }, * fontColor: { default: '#c9d8ea', active: '#ffffff' } * } * } * }); * ``` * * @example * Returning a view to its theme defaults, naming every state that should be unset: * ```ts * await view.updateOptions({ * workspacePlatform: { * viewTab: { * backgroundColor: { default: '', hover: '', active: '', focus: '' }, * fontColor: { default: '', hover: '', active: '', focus: '' } * } * } * }); * ``` */ export interface ViewTabAppearanceOptions { /** Tab background color per state. */ backgroundColor?: ViewTabStateColorOptions; /** Tab title text color per state. Does not affect the close or lock icons. */ fontColor?: ViewTabStateColorOptions; /** * Snapshot-safe controls rendered in this view's tab. * * Rendering requires the GoldenLayout 2 engine with scrolling tab overflow, which is how the * Core UI Browser creates its layouts (`experimental.layoutEngine: 'v2'`, the Browser default). * Windows that opt back in to the v1 engine render their tabs without custom controls, and this * option is ignored rather than rejected. * * Controls render at a fixed size, so the right-most ones are clipped on tabs that are too * narrow to fit them. */ controls?: ViewTabControl[]; }