Update
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
## termimg — Terminal Image Rendering for Nim
|
||||
## termimg - Terminal Image Rendering for Nim
|
||||
##
|
||||
## Picture-perfect image rendering in the native terminal. Renders RGBA
|
||||
## pixel data using the highest-fidelity protocol the terminal supports.
|
||||
|
||||
@@ -44,7 +44,7 @@ proc protocolsFromEnvironment(): set[Protocol] =
|
||||
|
||||
proc detectCapabilities*(): TerminalCapabilities =
|
||||
## Resolve terminal capabilities: size, cell size, and supported protocols.
|
||||
## Always returns valid values — never crashes even outside a terminal.
|
||||
## Always returns valid values - never crashes even outside a terminal.
|
||||
let rawCols = terminalWidth()
|
||||
let rawRows = terminalHeight()
|
||||
let columns = if rawCols > 0: rawCols else: 80
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Half-block Unicode renderer — universal fallback.
|
||||
## Half-block Unicode renderer - universal fallback.
|
||||
##
|
||||
## Uses ▀ (UPPER HALF BLOCK) with 24-bit foreground/background
|
||||
## colors. Two vertical samples per character cell. Works in any
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Quarter-block Unicode renderer — double-density fallback.
|
||||
## Quarter-block Unicode renderer - double-density fallback.
|
||||
##
|
||||
## Uses the Unicode quadrant block characters (▖▗▘▙▚▛▜▝▞▟█ and space)
|
||||
## to render 2×2 pixel samples per terminal cell. Each character
|
||||
@@ -23,22 +23,22 @@ type
|
||||
# 1 = foreground colour, 0 = background colour
|
||||
const
|
||||
QuadChars: array[16, string] = [
|
||||
" ", # 0000 — all background
|
||||
"▘", # 0001 — bottom-right only
|
||||
"▝", # 0010 — bottom-left only
|
||||
"▀", # 0011 — bottom row (both bottom quadrants)
|
||||
"▖", # 0100 — top-right only
|
||||
"▞", # 0101 — top-right + bottom-right (right column)
|
||||
"▚", # 0110 — top-right + bottom-left (diagonal)
|
||||
"▜", # 0111 — all except top-left
|
||||
"▗", # 1000 — top-left only
|
||||
"▙", # 1001 — all except top-right
|
||||
"▛", # 1010 — top-left + bottom-left (left column)
|
||||
"▟", # 1011 — all except bottom-right
|
||||
"▄", # 1100 — top row (both top quadrants)
|
||||
"▌", # 1101 — left column (top-left + bottom-left)
|
||||
"▐", # 1110 — right column (top-right + bottom-right)
|
||||
"█", # 1111 — all foreground
|
||||
" ", # 0000 - all background
|
||||
"▘", # 0001 - bottom-right only
|
||||
"▝", # 0010 - bottom-left only
|
||||
"▀", # 0011 - bottom row (both bottom quadrants)
|
||||
"▖", # 0100 - top-right only
|
||||
"▞", # 0101 - top-right + bottom-right (right column)
|
||||
"▚", # 0110 - top-right + bottom-left (diagonal)
|
||||
"▜", # 0111 - all except top-left
|
||||
"▗", # 1000 - top-left only
|
||||
"▙", # 1001 - all except top-right
|
||||
"▛", # 1010 - top-left + bottom-left (left column)
|
||||
"▟", # 1011 - all except bottom-right
|
||||
"▄", # 1100 - top row (both top quadrants)
|
||||
"▌", # 1101 - left column (top-left + bottom-left)
|
||||
"▐", # 1110 - right column (top-right + bottom-right)
|
||||
"█", # 1111 - all foreground
|
||||
]
|
||||
|
||||
proc foreground(color: Color): string =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Terminal image renderer — main API and protocol selector.
|
||||
## Terminal image renderer - main API and protocol selector.
|
||||
##
|
||||
## Auto-detects terminal capabilities and renders images using the
|
||||
## best available protocol. The priority order is:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## Terminal image rendering — shared types and geometry calculations.
|
||||
## Terminal image rendering - shared types and geometry calculations.
|
||||
|
||||
import std/math
|
||||
|
||||
|
||||
Reference in New Issue
Block a user