Skip to Content
defold-typescript libraries
britzldefold-richtext

britzl/defold-richtext/richtext.color

Rich-text rendering for Defold: styled spans, embedded tags, and per-color text runs.

  • GitHub: britzl/defold-richtext — pinned to 5.22.1
    1. Pick a release from britzl/defold-richtext releases and add its Source code (zip) URL (or a packaged .zip asset, if the library ships one) to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as color from "richtext.color"

Functions

add(name: string, color: number | string)

Parameters

  • name: string
  • color: number | string

parse(c: string): Vector4 | undefined

Resolves a color by name, hex string or comma-separated decimal string.

Parameters

  • c: string

Returns

  • Vector4 | undefined

parse_hex(hex: string): Vector4 | undefined

Parses a #rrggbb or #rrggbbaa hex string, with or without the leading #.

Parameters

  • hex: string

Returns

  • Vector4 | undefined

parse_decimal(dec: string): Vector4 | undefined

Parses a comma-separated r,g,b,a string of decimal components.

Parameters

  • dec: string

Returns

  • Vector4 | undefined

Variables

COLORS: { aqua: Vector4; black: Vector4; blue: Vector4; brown: Vector4; cyan: Vector4; darkblue: Vector4; fuchsia: Vector4; green: Vector4; grey: Vector4; lightblue: Vector4; lime: Vector4; magenta: Vector4; maroon: Vector4; navy: Vector4; olive: Vector4; orange: Vector4; purple: Vector4; red: Vector4; silver: Vector4; teal: Vector4; white: Vector4; yellow: Vector4; }

On this page