Mika Scraper / TextCraftClient
Class: TextCraftClient
Defined in: src/textcraft/TextCraftClient.ts:65
The TextCraftClient
is a client used for generating Minecraft-style images based on input text. It is designed to be configurable and reusable in different contexts.
Constructors
Constructor
new TextCraftClient(
options?
):TextCraftClient
Defined in: src/textcraft/TextCraftClient.ts:69
Parameters
options?
Type: TextCraftClientOptions
An optional configuration object that allows customization of the TextCraftClient
instance.
Returns
TextCraftClient
An instance of the TextCraftClient
.
Methods
generateImage()
generateImage(
input
):Promise
<string
>
Defined in: src/textcraft/TextCraftClient.ts:96
Generates a Minecraft-style image using the provided text and optional styles.
Parameters
input
Type: object
An object containing the required text and optional style overrides.
text
Type: string
The primary text to be rendered on the image.
text2?
Type: string
An optional second line of text.
text3?
Type: string
An optional third line of text.
fontStyle?
Type: string
An optional CSS font style for the text.
fontStyle2?
Type: string
An optional CSS font style for the second text line.
fontStyle3?
Type: string
An optional CSS font style for the third text line.
fontSize?
Type: string
An optional font size for the text.
fontSize2?
Type: string
An optional font size for the second text line.
fontSize3?
Type: string
An optional font size for the third text line.
fontColour?
Type: string
An optional color specification for the text.
fontColour2?
Type: string
An optional color specification for the second text line.
fontColour3?
Type: string
An optional color specification for the third text line.
borderColour?
Type: string
An optional border color for the image.
borderColour2?
Type: string
An optional border color for the second text line.
borderColour3?
Type: string
An optional border color for the third text line.
dropShadow?
Type: boolean
Indicates whether a drop shadow should be applied to the text.
glossy?
Type: boolean
Indicates whether to apply a glossy effect to the image.
lighting?
Type: boolean
Indicates whether lighting effects should be applied.
glitterBorder?
Type: boolean
Indicates whether a glitter border should be applied to the image.
Returns
Promise<string>
A Promise
that resolves to a direct URL of the generated image.
Example Usage
const client = new TextCraftClient();
const imageUrl = await client.generateImage({
text: 'Hello World',
fontSize: '24px',
fontColour: '#FF5733',
dropShadow: true,
});
console.log(imageUrl);