📗
Wiki
  • WIKI
  • Plugins
    • InfoHeads
      • Installation
      • FAQ
      • Using the Wizard
    • MailMe
      • Updating to MailMe Rewrite
      • FAQ
      • Setup
      • Tutorials
        • Niche
        • MailPresets
      • API
        • Setup
        • Interacting with the Database
  • Libraries
    • ProtectionAPI
      • Introduction
      • Getting Started
      • Tutorials
        • Creating a UniversalRegion
        • Collision Detection
      • Change Log
    • HexiTextLib
      • Introduction
      • Setup
        • Gradle
        • Maven
      • Using HexResolver
      • Using FontResolver
      • Change Log
Powered by GitBook
On this page
  • Formatting
  • Parsing String

Was this helpful?

  1. Libraries
  2. HexiTextLib

Using HexResolver

This page explains how to use the hex parser for hex colour codes and gradients

Formatting

  • Standard Hex Colours:

    • <#RRGGBB>

    • <#34ebe5>

  • Gradient Hex Colours:

    • <gradient:#RRGGBB:#RRGGBB>

    • <gradient:#34ebe5:#03fcec>

  • Gradient Hex Colours with stops:

    • <gradient:#RRGGBB:#RRGGBB:#RRGGBB...>

    • <gradient:#34ebe5:#03fcec:#34ebe5>

Parsing String

Parsing a string is a very simple process, if the server supports 1.16 it'll attempt to translate the hex into valid colours otherwise it'll just use the old codes: &a

Using the default regex pattern

String text = "<#34ebe5> My text";
String parsedText = HexResolver.parseString(text);

Using your own regex pattern

String text = "<#34ebe5>"
String parsedText = HexResolver.parseString(text, pattern);

Custom patterns only work for the single coloured hex. It will not adjust the format of gradients. This is not adjustable

PreviousMavenNextUsing FontResolver

Last updated 4 years ago

Was this helpful?