rendering library Ultraviolet

Diff rendering, ANSI styling, effects, and terminal graphics primitives.

This entrypoint also exports core.dart so rendering consumers can work with buffers and cells through a single stable package boundary.

Classes

AmberTerminalFilter
Amber monochrome display preset built from the UV filter primitives.
AmberTrailFilter
Warm monochrome preset with a short-lived persistence trail.
AtmosphereFilter
Soft atmosphere-style preset for shimmer/backdrop motion.
Attr
Text attributes (bitmask).
Buffer
A 2D buffer of Lines representing a terminal screen or a portion of it.
BufferFilter
Base class for buffer filters.
BufferRenderSink
A render sink that owns double-buffered render targets.
Canvas
Canvas is a cell-buffer that can be used to compose and draw Drawables.
Cell
A single cell in a terminal Buffer.
CellDiffOption
Controls how a Cell participates in terminal-buffer diffing.
ClearableScreen
Optional fast-path: clear the entire screen.
ClearAreaScreen
Optional fast-path: clear an area of the screen.
CloneableScreen
Optional fast-path: clone the entire screen into a buffer.
CloneAreaScreen
Optional fast-path: clone a screen area into a buffer.
ColorMatrix
A 4x5 RGBA color matrix.
ColorMatrixFilter
A BufferFilter that applies a ColorMatrix to cell style colors.
CompositeFilter
Runs multiple filters as one reusable filter.
Compositor
Compositor manages layer composition, drawing and hit testing.
Constraint
Layout constraints.
CrtFilter
Opinionated CRT-style preset built from the UV filter primitives.
CrtTrailFilter
CRT-style preset with a short temporal persistence trail.
Drawable
Drawable can draw itself into a Screen.
EmptyDrawable
A no-op drawable with a fixed size.
FillableScreen
Optional fast-path: fill the entire screen.
FillAreaScreen
Optional fast-path: fill an area of the screen.
Fixed
A constraint that represents a fixed size.
GhostingFilter
Preserves a fading afterimage of recent glyphs.
HalfBlockImageDrawable
A Drawable that renders an image using half-block characters.
ITerm2Image
Utilities for the iTerm2 Image Protocol.
ITerm2ImageDrawable
A Drawable that renders an image using the iTerm2 Image Protocol.
KittyImage
Utilities for the Kitty Graphics Protocol.
KittyImageDrawable
A Drawable that renders an image using the Kitty Graphics Protocol.
Layer
Layer represents a visual layer with content and positioning.
LayerHit
Line
A line is a fixed-width list of cells.
LineData
Metadata for one dirty line.
Terminal hyperlink metadata (OSC 8).
LinkState
Holds the parsed hyperlink URL from an OSC 8 sequence.
LiquifyFilter
A simple velocity-field liquify filter.
OwnedCellScreen
Optional fast-path: set a cell that the caller will not reuse.
Percent
A constraint that represents a percentage of the available size.
PhosphorFilter
Green phosphor display preset with a stronger CRT feel.
PhosphorTrailFilter
Green phosphor preset with a temporal afterimage trail.
Position
A 2D integer coordinate in terminal cell space.
ProgressBar
A progress bar state + value.
Rectangle
Rectangle with inclusive-exclusive bounds: [min, max).
RenderMetrics
Tracks render performance metrics including FPS, frame times, and render durations.
ScanlineFilter
Adds alternating scanline attenuation with an optional animated rolling bar.
Screen
Screen is a 2D surface of cells.
ScreenBuffer
A screen buffer that implements Screen operations and carries a width method for calculating cell widths.
SgrParam
Represents a parsed SGR (Select Graphic Rendition) parameter.
Side
UvBorder primitives.
SixelImage
Utilities for Sixel Graphics.
SixelImageDrawable
A Drawable that renders an image using Sixel Graphics.
StyledString
StyledString is a string that can be decomposed into a series of styled lines and cells.
StyleState
Holds the result of parsing an SGR sequence.
TerminalCapabilities
Terminal capabilities discovered via ANSI queries.
TerminalGraphicsControl
One parsed terminal graphics control sequence.
TerminalGraphicsFrame
Retained graphics state visible in a rendered frame.
TerminalRenderer
Abstract base class for UV terminal renderers.
UvAnsi
A collection of ANSI escape sequence constants and utilities.
UvBasic16
16-color palette index (optionally bright).
UvBorder
A drawable border composed of Sides and corner glyphs.
UvColor
Color representation sufficient for Ultraviolet parity tests.
UvIndexed256
256-color indexed palette entry.
UvRgb
24-bit RGBA color.
UvStyle
Style attributes for a terminal Cell.
UvTerminalRenderer
Low-level terminal renderer for the Ultraviolet engine.
VignetteFilter
Darkens the edges of the frame while preserving the center.
WaveDistortionFilter
Applies a deterministic sine-wave distortion across the buffer.

Enums

ProgressBarState
Progress bar states.
TerminalGraphicsProtocol
Terminal graphics protocols that can appear as display payloads.
UnderlineStyle
Underline style for terminal cells.

Functions

asciiBorder() UvBorder
Creates a plain ASCII border style.
blockBorder() UvBorder
Creates a solid block border style.
bottomCenterRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the bottom-center of area with width and height.
bottomLeftRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the bottom-left of area with width and height.
bottomRightRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the bottom-right of area with width and height.
centerRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle centered within area with width and height.
clampRgbChannel(int x) int
Clamps a color component to the byte range required by SGR truecolor.
clear(Screen screen) → void
Screen helpers for clearing/filling/cloning.
clearArea(Screen screen, Rectangle area) → void
Clears area of screen to empty cells.
clipAnsiByCells(String s, int start, int end) String Ultraviolet
Clips a styled line to the exact cell interval [start, end).
clone(Screen screen) Buffer
Returns a copy of screen as a Buffer.
cloneArea(Screen screen, Rectangle area) Buffer?
Returns a copy of area from screen, or null when empty.
colorToHex(UvRgb? c) String
Formats c as a #RRGGBB hex string, or empty if null.
containsRetainedTerminalGraphics(String value) bool
Whether value contains retained graphics.
containsSixelDisplay(String value) bool
Whether value contains a Sixel display payload.
containsTerminalGraphicsDisplay(String value) bool
Whether value contains any terminal graphics display sequence.
Converts a Link to respect the given terminal color profile.
convertStyle(UvStyle style, Profile profile) UvStyle
Converts a UvStyle to respect the given terminal color profile.
cutAnsiByCells(String s, int start, int end) String
Cuts an ANSI string by visible cell indices, preserving any active SGR/OSC 8 state at the start boundary.
debugDirectRelativeMoveSeq(UvTerminalRenderer renderer, Buffer newbuf, int fx, int fy, int tx, int ty, {bool useTabs = false, bool useBackspace = false}) String
Returns the direct relative move sequence used as the DP baseline.
debugDpOverwriteMoveSeq(UvTerminalRenderer renderer, Buffer newbuf, int fx, int fy, int tx, int ty, {bool useTabs = false, bool useBackspace = false}) String?
Returns the same-row DP overwrite/move sequence used by the renderer.
deleteAllRetainedGraphics({int quiet = 2}) String
Returns the retained-graphics delete-all sequence.
deleteRetainedGraphic(int imageId, {int quiet = 2}) String
Returns the retained-graphics delete sequence for imageId.
doubleBorder() UvBorder
Creates a double line border style.
fill(Screen screen, Cell? cell) → void
Fills the entire screen with cell.
fillArea(Screen screen, Cell? cell, Rectangle area) → void
Fills area of screen with cell.
getMaxMin(double a, double b, double c) → (double, double)
Returns the max and min of three values.
hiddenBorder() UvBorder
Creates an invisible border style (spaces for all sides).
innerHalfBlockBorder() UvBorder
Creates an inner half-block border style.
isDarkColor(UvRgb? c) bool
Returns whether c is considered dark using HSL lightness.
leftCenterRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the left-center of area with width and height.
markdownBorder() UvBorder
Creates a markdown-style border using | for verticals.
mayContainTerminalGraphics(String value) bool
Whether value can contain one of the graphics protocols handled here.
newLayer(Object content, [List<Layer> layers = const []]) Layer
Creates a new Layer from a String or Drawable.
newStyledString(String str) StyledString
Factory function to create a StyledString from str.
normalBorder() UvBorder
outerHalfBlockBorder() UvBorder
Creates an outer half-block border style.
parseTerminalGraphicsControls(String value) Iterable<TerminalGraphicsControl>
Parses terminal graphics controls in value.
ratio(int numerator, int denominator) Percent
Syntactic sugar for Percent.
Parses an OSC 8 hyperlink sequence from data into out.
readStyle(List<SgrParam> params, StyleState out) → void
Parses SGR params and applies them to the style in out.
rect(int x, int y, int width, int height) Rectangle
Creates a rectangle from origin (x, y) and size (width, height).
rgbToHsl(int r, int g, int b) → (double, double, double)
Returns (h, s, l) where h is degrees [0, 360).
rightCenterRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the right-center of area with width and height.
roundedBorder() UvBorder
Creates a rounded border style.
shift(int x) int
Shifts a 16-bit color component down to 8-bit.
sourceOver(UvColor? src, UvColor? dst) UvColor?
Composites src over dst using Porter-Duff SourceOver.
splitByLargestRemainder(int size, List<int> weights, {List<int> previous = const []}) List<int>
Splits size cells across weights using Largest Remainder Method.
splitHorizontal(Rectangle area, Constraint c) → ({Rectangle left, Rectangle right})
Splits area horizontally into left/right.
splitHorizontalByLargestRemainder(Rectangle area, List<int> weights, {List<int> previousAllocations = const []}) → ({List<Rectangle> columns})
Splits area into horizontal segments using stable largest-remainder sizing.
splitVertical(Rectangle area, Constraint c) → ({Rectangle bottom, Rectangle top})
Splits area vertically into top/bottom.
splitVerticalByLargestRemainder(Rectangle area, List<int> weights, {List<int> previousAllocations = const []}) → ({List<Rectangle> rows})
Splits area into vertical segments using stable largest-remainder sizing.
styleDiff(UvStyle? from, UvStyle? to) String
Returns the SGR diff needed to transition from from to to.
styleToSgr(UvStyle style) String
Returns the SGR sequence for style.
styleTransitionSgr(UvStyle? from, UvStyle? to) String
Returns the cheaper SGR transition from from to to.
suppressOverflowingTerminalGraphics(String text, int viewportHeight) String
Removes graphics displays that would paint outside viewportHeight.
terminalGraphicsCellWidth(String line) int
Additional cell width contributed by graphics controls embedded in line.
terminalGraphicsControlCellWidth(String controls) int
Cell width for a pending control sequence group.
terminalGraphicsControlsDisplayImage(String controls) bool
Whether a pending control sequence group displays graphics.
terminalGraphicsSuppressesCursorMovement(String value) bool
Whether value displays graphics while suppressing terminal cursor motion.
thickBorder() UvBorder
Creates a thick line border style.
topCenterRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the top-center of area with width and height.
topLeftRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the top-left of area with width and height.
topRightRect(Rectangle area, int width, int height) Rectangle
Returns a new Rectangle at the top-right of area with width and height.
truncateLeftAnsiByCells(String s, int start) String
Truncates an ANSI string from the left by visible cell indices.
wrapAnsiPreserving(String input, int width, {String breakpoints = ''}) String
Wraps a string to width while preserving ANSI pen state (SGR + OSC 8) across inserted and existing newlines.