Blocks - HB-Hridoy/th-m-l-t GitHub Wiki

🧩 Blocks

Methods

🟪 Initialize

Purpose: Initializes and loads data for color themes, fonts, and translations.

Initialize_Method

Parameter Type
colorThemes text
fonts text
translations text

🔧 Need help configuring your Translations, Fonts, or Colors?

📖 Follow the official Data Configuration Guide → to set up your JSON schemas correctly.


🟪 ApplyFormatting

Purpose: Applies formatting to a layout using the active theme and language.

ApplyFormatting_Method

Parameter Type
layout component

🟪 ApplyCustomizedFormatting

Purpose: Applies formatting to a layout using a specific theme and language.

ApplyCustomizedFormatting_Method

Parameter Type
layout component
themeMode text
languageCode text

🟪 Get

Purpose: Retrieves a list of values for a given data category.

Get_Method

Parameter Type
data All (helper enums)

Return: list
Why: Returns the complete list of items for enums like PrimitiveKeys, SemanticKeys, ThemeModes, FontTags, FontShortTags, TranslationKeys, SupportedLanguages.


🟪 GetTranslation

Purpose: Returns a translation for a given key using the active language.

GetTranslation_Method

Parameter Type
translationKey text

Return: text
Why: Returns the corresponding translation string, or Not Found if missing.


🟪 GetFont

Purpose: Returns a font name for a given key using the tag.

GetFont_Method
Parameter Type
tag text

Return: text
Why: Returns the corresponding font name, or Font not found if missing.


🟪 GetTranslationForLanguage

Purpose: Returns a translation for a key in a specific language.

GetTranslationForLanguage_Method

Parameter Type
translationKey text
languageCode text

Return: text
Why:

  • Returns the translation string if found.
  • Returns Not Found if the key is missing.
  • Returns 'languageCode' is not supported if the languageCode is invalid.

🟪 GetPrimitiveColor

Purpose: Retrieves a primitive color as an integer value.

GetPrimitiveColor_Method

Parameter Type
key text

Return: number
Why:

  • Returns the integer color value if key exists.
  • Returns -1 if not found (error condition).

🟪 GetSemanticColorSource

Purpose: Retrieves the source reference of a semantic color for the active theme.

GetSemanticColorSource_Method

Parameter Type
key text

Return: text
Why:

  • Returns the primitive color key.
  • Returns a detailed error if the theme or key doesn't exist.

🟪 GetSemanticColor

Purpose: Retrieves a semantic color value (int) for the active theme mode.

GetSemanticColor_Method

Parameter Type
key text

Return: number
Why:

  • Returns resolved color as int if found.
  • Returns -1 if theme mode or color key is invalid.

🟪 GetSemanticColorByThemeMode

Purpose: Retrieves a semantic color value for a specific theme mode.

GetSemanticColorByThemeMode_Method

Parameter Type
key text
themeMode text

Return: number
Why:

  • Returns resolved color as int if key exists in the given mode.
  • Returns -1 for missing theme/key.
Properties

🔧 Setters

🟩 FontRegular

Sets the regular font.

FontRegular_Set_Property

Input Type
font text

🟩 FontBold

Sets the bold font.

FontBold_Set_Property

Input Type
font text

🟩 FontMaterial

Sets the material icon font.

FontMaterial_Set_Property

Input Type
font text

🟩 ColorPrimary

Sets the primary color.

ColorPrimary_Set_Property

Input Type
color number

🟩 ColorSecondary

Sets the secondary color.

ColorSecondary_Set_Property

Input Type
color number

🟩 ColorAccent

Sets the accent color.

ColorAccent_Set_Property

Input Type
color number

🟩 Language

Sets the active translation language.

Language_Set_Property

Input Type
code text

🟩 ThemeMode

Sets the active theme mode (e.g., light, dark).

ThemeMode_Set_Property

Input Type
mode text

🔍 Getters

🟩 FontRegular

Gets the regular font.

FontRegular_Get_Property

Return Type
font text

🟩 FontBold

Gets the bold font.

FontBold_Get_Property

Return Type
font text

🟩 FontMaterial

Gets the material font.

FontMaterial_Get_Property

Return Type
font text

🟩 ColorPrimary

Gets the primary color.

ColorPrimary_Get_Property

Return Type
color number

🟩 ColorSecondary

Gets the secondary color.

ColorSecondary_Get_Property

Return Type
color number

🟩 ColorAccent

Gets the accent color.

ColorAccent_Get_Property

Return Type
color number

🟩 Language

Gets the current language code.

Language_Get_Property

Return Type
code text

🟩 ThemeMode

Gets the current theme mode.

ThemeMode_Get_Property

Return Type
mode text
Events

🟨 ErrorOccurred

Occurs when an error happens

ErrorOccurred_Event

Parameter Type
errorFrom text
error text
⚠️ **GitHub.com Fallback** ⚠️