core library Ultraviolet
Core cell-buffer, geometry, layout, and drawing primitives.
Import this entrypoint when an application needs to build or manipulate terminal frames without terminal lifecycle, input decoding, or rendering.
Classes
- Attr
- Text attributes (bitmask).
- Buffer
- A 2D buffer of Lines representing a terminal screen or a portion of it.
- 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.
- Compositor
- Compositor manages layer composition, drawing and hit testing.
- Constraint
- Layout constraints.
- 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.
- 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.
- Link
- Terminal hyperlink metadata (OSC 8).
- LinkState
- Holds the parsed hyperlink URL from an OSC 8 sequence.
- OwnedCellScreen
- Optional fast-path: set a cell that the caller will not reuse.
- Percent
- A constraint that represents a percentage of the available size.
- Position
- A 2D integer coordinate in terminal cell space.
- Rectangle
-
Rectangle with inclusive-exclusive bounds:
[min, max). - Screen
- Screen is a 2D surface of cells.
- ScreenBuffer
-
A screen buffer that implements
Screenoperations and carries a width method for calculating cell widths. - SgrParam
- Represents a parsed SGR (Select Graphic Rendition) parameter.
- Side
- UvBorder primitives.
- 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.
- 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.
Enums
- 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
areawithwidthandheight. -
bottomLeftRect(
Rectangle area, int width, int height) → Rectangle -
Returns a new Rectangle at the bottom-left of
areawithwidthandheight. -
bottomRightRect(
Rectangle area, int width, int height) → Rectangle -
Returns a new Rectangle at the bottom-right of
areawithwidthandheight. -
centerRect(
Rectangle area, int width, int height) → Rectangle -
Returns a new Rectangle centered within
areawithwidthandheight. -
clampRgbChannel(
int x) → int - Clamps a color component to the byte range required by SGR truecolor.
-
colorToHex(
UvRgb? c) → String -
Formats
cas a#RRGGBBhex string, or empty if null. -
doubleBorder(
) → UvBorder - Creates a double line border style.
-
getMaxMin(
double a, double b, double c) → (double, double) - Returns the max and min of three values.
- Creates an invisible border style (spaces for all sides).
-
innerHalfBlockBorder(
) → UvBorder - Creates an inner half-block border style.
-
isDarkColor(
UvRgb? c) → bool -
Returns whether
cis considered dark using HSL lightness. -
leftCenterRect(
Rectangle area, int width, int height) → Rectangle -
Returns a new Rectangle at the left-center of
areawithwidthandheight. -
markdownBorder(
) → UvBorder -
Creates a markdown-style border using
|for verticals. -
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.
-
ratio(
int numerator, int denominator) → Percent - Syntactic sugar for Percent.
-
readLink(
String data, LinkState out) → void -
Parses an OSC 8 hyperlink sequence from
dataintoout. -
readStyle(
List< SgrParam> params, StyleState out) → void -
Parses SGR
paramsand applies them to the style inout. -
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)wherehis degrees[0, 360). -
rightCenterRect(
Rectangle area, int width, int height) → Rectangle -
Returns a new Rectangle at the right-center of
areawithwidthandheight. -
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
srcoverdstusing Porter-Duff SourceOver. -
splitByLargestRemainder(
int size, List< int> weights, {List<int> previous = const []}) → List<int> -
Splits
sizecells acrossweightsusing Largest Remainder Method. -
splitHorizontal(
Rectangle area, Constraint c) → ({Rectangle left, Rectangle right}) -
Splits
areahorizontally into left/right. -
splitHorizontalByLargestRemainder(
Rectangle area, List< int> weights, {List<int> previousAllocations = const []}) → ({List<Rectangle> columns}) -
Splits
areainto horizontal segments using stable largest-remainder sizing. -
splitVertical(
Rectangle area, Constraint c) → ({Rectangle bottom, Rectangle top}) -
Splits
areavertically into top/bottom. -
splitVerticalByLargestRemainder(
Rectangle area, List< int> weights, {List<int> previousAllocations = const []}) → ({List<Rectangle> rows}) -
Splits
areainto vertical segments using stable largest-remainder sizing. -
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
areawithwidthandheight. -
topLeftRect(
Rectangle area, int width, int height) → Rectangle -
Returns a new Rectangle at the top-left of
areawithwidthandheight. -
topRightRect(
Rectangle area, int width, int height) → Rectangle -
Returns a new Rectangle at the top-right of
areawithwidthandheight.