Ink Functions - Rafostar/ink GitHub Wiki

Ink.colorFrom256

Ink.colorFrom256(number)

Returns a string color code representing selected color from 256 color palette.

Meant for use as a value for printer.color or printer.background property.

256 Color Palette Preview

Use values from this palette preview to get a corresponding colors with above function.

Ink.colorFromRGB

Ink.colorFromRGB(red, green, blue)

Returns a string color code with corresponding "True Color" value (16M colors). Arguments should represent each color value in form of number from 0 to 255. Pass either 3 separate values or an array.

Meant for use as a value for printer.color or printer.background property.

Ink.colorFromHex

Ink.colorFromHex(string || [red, green, blue])

Returns a string color code with corresponding color value. Takes as input single string argument (can be preceded with # character e.g. #FFFFFF) or three color values in hex as either separate arguments or in an array. Each color (RGB) must be provided as string in form of a hex value from '00' to 'FF' (letter case insensitive).

Meant for use as a value for printer.color or printer.background property.

Ink.colorFromText

Ink.colorFromText(string)

Returns a string color code with a color value. Takes a single string as input (any text) and returns a single color from 256 color palette depending on calculated string value.

Meant for use as a value for printer.color or printer.background property.

Ink.fontFromText

Ink.fontFromText(string)

Takes a single string as input (any text) and returns a single font from Ink.Font fonts depending on calculated string value.

Meant for use as a value for printer.font property.