Battle Brothers
0 of 0

File information

Last updated

Original upload

Created by

Enduriel

Uploaded by

Endur1el

Virus scan

Safe to use

Tags for this mod

About this mod

This is a mod meant for modders to allow them to easily add colored text to the UI.

Requirements
Permissions and credits
Changelogs
When I was working on my Settlement Price Multiplier Info mod I wanted to add a color gradient to UI text and realized that the default functions & objects in the game code and in Squirrel generally are awful for this. Therefore I created my own color object that allows you to implement color mixing or editing easily.

to create a new color object use

local color = this.new("scripts/mods/ends_color");

You can then set the color to whatever you want either by using a string such as "ffffff" or "#ffffff" or you can set each rgb property respectively with an int

color.setColorFromString("ffffff");
color.setColorFromString("#ffffff");

color.m.r = 255;
color.m.g = 255;
color.m.b = 255;


You can get the color in String form by doing

return color.getColorString();
//returns string in form "#ffffff"


And finally the main reason to use this object, you can easily mix 2 colors by a certain amount.

local otherColorAmountAsPercent = 25;
local newcolor = color.getMixWithColor(othercolor, otherColorAmountAsPercent);
//the newcolor will look like 75% color and 25% othercolor


And you can then use newcolor.getColorString() as though it were this.Const.UI.Color.Whatever to display your newly mixed color.