components/pixel-number
Type Aliases
Section titled “Type Aliases”PixelNumberSize
Section titled “PixelNumberSize”PixelNumberSize =
"sm"|"md"|"lg"|"xl"
Supported PixelNumber sizes: one font pixel is 2, 3, 4 or 6 CSS pixels.
PixelNumberTone
Section titled “PixelNumberTone”PixelNumberTone =
"current"|"primary"|"accent"|"success"|"warning"|"error"
Semantic tones supplied by the current theme.
PixelNumberProps
Section titled “PixelNumberProps”PixelNumberProps =
Omit<HTMLAttributes<HTMLSpanElement>>,"children"> > &object
Props accepted by PixelNumber. Pass a value, or readout text.
Type Declaration
Section titled “Type Declaration”value?
Section titled “value?”
optionalvalue?:number
A number to draw.
optionaltext?:string
Readout text instead of a number: digits and : . + - / × % and spaces.
optionalpad?:number
Left-pad the whole part of value with zeros to this many digits.
signed?
Section titled “signed?”
optionalsigned?:boolean
Prefix a positive value with +, for gains and floating numbers.
optionalsize?:PixelNumberSize
optionaltone?:PixelNumberTone
outline?
Section titled “outline?”
optionaloutline?:boolean
Ring every lit pixel with the ink line, like a sprite outline, so the number reads over any world: damage, pickups and floating gains.
Variables
Section titled “Variables”PIXEL_NUMBER_CHARACTERS
Section titled “PIXEL_NUMBER_CHARACTERS”
constPIXEL_NUMBER_CHARACTERS: readonlystring[]
Characters the pixel face can draw.
PixelNumber
Section titled “PixelNumber”
constPixelNumber:ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLSpanElement>>,"children"> > &object&RefAttributes<HTMLSpanElement>>>>
Crisp pixel numerals drawn as SVG, so they stay sharp at every size and never depend on a font file. The readable text is kept for assistive tech.
Functions
Section titled “Functions”formatPixelNumber()
Section titled “formatPixelNumber()”formatPixelNumber(
value,pad?,signed?):string
Format a number the way PixelNumber draws it.
Parameters
Section titled “Parameters”number
number = 0
signed?
Section titled “signed?”boolean = false
Returns
Section titled “Returns”string
checkPixelText()
Section titled “checkPixelText()”checkPixelText(
text):string
Reject characters the pixel face cannot draw, naming the ones it can.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string