-
Notifications
You must be signed in to change notification settings - Fork 1
AsciifyOptions
The options used to configure the ASCII art.
- backgroundColor
- characterSet
- characterSpacingRatio
- colorize
- contrastRatio
- flipY
- fontFamily
- fontSize
- pixelRatio
- scratchCanvas
• backgroundColor: string
The background color of the character set.
This may be set to any valid CSS color. Note that this will only apply to the background of the ASCII characters. The source image pixel data ultimately determines which character is used.
Default
'#000000'
• characterSet: string
| string
[]
The available characters to use for the ASCII art. Characters should be in order of "brightness", with the first character being the least bright and the last being the most bright.
Default
See
- OptionPreset
contrastRatio
• characterSpacingRatio: number
The spacing ratio to use for the characters.
This should be a multiple of the font size, usually between 0.8 and 2. Larger ratios will result in more spacing between lines and a faster render time. Smaller ratios will result in more characters fitting on the screen and a slower render time.
A ratio less than 1 will result in the characters being squished closer together, and when paired with small font sizes, will result in the characters being illegible.
Default
1
• colorize: boolean
Whether to use color in the ASCII art.
Default
true
• contrastRatio: number
The contrast ratio use to pad the character set across the luminance range. This is a value between 0 and 255, with a usual range between 0 and 5. A lower value will result in the character set being used more often and slower rendering. A higher value will result in empty space being used more often and faster rendering.
Default
3
• flipY: boolean
Whether to flip the canvas vertically for Three.js
Default
true
• fontFamily: string
The font family to use for the ASCII art.
Default
'monospace'
• fontSize: number
The font size to use for the ASCII art.
The larger the font size, the fewer characters will fit on the screen. Make sure to use a known font size, otherwise Safari will choose an approximate size.
Default
10
• pixelRatio: number
The device pixel ratio to use for the ASCII art.
Default
devicePixelRatio
Browser
Default
1 Node.js and Workers
• scratchCanvas: CanvasLike
| Canvas2dContextLike
A cached canvas to use while performing operations. Asciify will automatically cache a canvas internally if not provided.