Jump to content

Recommended Posts

Posted

My mod has a feature that reads a text files and displays the content in a gui. Now, I need to check if the string contains any color codes (section symbol + color). My problem is how do I turn the color code into an int so I can draw the string.

Posted

FontRender#drawString takes an int parameter for the color, which is a single-value representation of the RGB values.

 

There are color charts available online, or you can search through Minecraft's code for their chat formatting color codes to find their values.

 

I have looked at TextFormatting and I was not able to find anything like this. I tried to look at the mc GUIs that can handle colored texts (world selector, resource pack selector, etc) but I was not able to find anything that could help me.

Posted

I don't think there is any sort of color code -> int mapping anywhere in Minecraft. You either map them out yourself, or you ask your users to use the integer value of the color they want rather than a string code.

 

Well that sucks, I'll probably allow custom ints then as that allows more customization

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.