Skip to content

Styles and CSS variables

Import the engine stylesheet once in a browser application:

ts
import '@inklayer-dev/core/style'

Every Annotation Engine instance adds .inklayer-engine, data-inklayer-instance, and data-inklayer-tool only to its supplied root. Attached page containers receive reversible data-inklayer-page and instance metadata. Destroy removes all metadata owned by that engine. Core never changes body, html, or a fixed global element ID.

Override one Viewer

Set variables on the root passed to createInkLayer(). This keeps the theme local to that instance:

css
.review-viewer.inklayer-engine {
  --inklayer-author-label-background: #7c3aed;
  --inklayer-search-active-background: rgb(124 58 237 / 55%);
  --inklayer-text-input-border: #7c3aed;
  --inklayer-accessibility-focus-ring: #a78bfa;
}

Core adds .inklayer-engine after initialization, so the application only needs to place review-viewer on its root element.

Public variables

All variables are optional and have a standalone fallback in the generated CSS. Override them on one engine root to avoid affecting another instance.

VariableDefaultPurpose
--inklayer-author-label-background#1677ffAuthor/reference label background
--inklayer-author-label-foreground#fffAuthor/reference label text
--inklayer-author-label-font-size12pxLabel text size
--inklayer-author-label-radius3pxLabel corner radius
--inklayer-author-label-padding2px 5pxLabel inner spacing
--inklayer-overlay-z-index2Konva canvas overlay layer
--inklayer-text-layer-z-index1Selectable PDF.js TextLayer
--inklayer-selection-z-index3Labels and temporary input layer
--inklayer-accessibility-z-index4Focused Canvas semantic alternative layer
--inklayer-accessibility-background#101828Focused annotation alternative background
--inklayer-accessibility-foreground#fffFocused annotation alternative text
--inklayer-accessibility-focus-ring#84adffEngine and annotation keyboard focus ring
--inklayer-search-highlight-backgroundrgb(250 204 21 / 45%)Search match background
--inklayer-search-active-backgroundrgb(249 115 22 / 60%)Active search match background
--inklayer-search-active-outlinergb(194 65 12 / 70%)Active search match outline
--inklayer-text-input-background#fffFreeText editor background
--inklayer-text-input-border#1677ffFreeText editor border
--inklayer-text-input-foreground#111827FreeText editor text
--inklayer-text-input-focus-ringrgb(22 119 255 / 25%)Keyboard focus indicator
--inklayer-cursor-selectdefaultExisting-annotation selection cursor
--inklayer-cursor-text-markupembedded SVGHighlight/underline/strikeout cursor
--inklayer-cursor-shapecrosshairShape, line, and path cursors
--inklayer-cursor-freehandembedded SVGFreehand pen cursor
--inklayer-cursor-free-highlightembedded SVGFree-highlight marker cursor
--inklayer-cursor-notecopyNote placement cursor
--inklayer-cursor-free-texttextFreeText placement cursor
--inklayer-cursor-signaturecopyPrepared Signature image placement cursor
--inklayer-cursor-stampcopyPrepared Stamp image placement cursor
--inklayer-cursor-image-missingnot-allowedSignature/Stamp cursor before an image is prepared

Runtime cursor variables

After setImageAsset, Core creates the instance-local --inklayer-cursor-signature-asset or --inklayer-cursor-stamp-asset runtime value. It is a bounded thumbnail of the actual image with an outline, shadow and center hotspot; it is removed when the asset is cleared or the engine is destroyed. These two generated variables are runtime state rather than consumer configuration.

What the stylesheet owns

Core CSS styles only renderer wrappers, Konva placement, author labels, temporary FreeText input, cursor state, pointer routing, and stacking. Toolbars, sidebars, dialogs, application layout, scrollbar appearance, and brand themes belong to consumers. .inklayer-page-flow is a stable styling hook, but Core does not prescribe scrollbar width, colors, hover treatment, or platform theme. The text-select tool disables page Canvas hit routing so the PDF.js TextLayer can create a native browser selection; select restores annotation manipulation. Core chooses cursor semantics for each interaction mode; consumers may theme the published variables without reimplementing the tool-to-cursor mapping.

Private PDF.js variables

PDF.js TextLayer implementation variables such as --font-height, --scale-x, and --text-scale-factor may appear below .inklayer-text-layer. They are private compatibility details populated by PDF.js, not consumer theme tokens.

Released under the MIT License.