This is a mod meant for modders to allow them to easily add colored text to the UI.
Requirements
This mod does not have any known dependencies other than the base game.
Permissions and credits
Credits and distribution permission
Other user's assetsAll the assets in this file belong to the author, or are from free-to-use modder's resources
Upload permissionYou are not allowed to upload this file to other sites under any circumstances
Modification permissionYou are allowed to modify my files and release bug fixes or improve on the features so long as you credit me as the original creator
Conversion permissionYou are not allowed to convert this file to work on other games under any circumstances
Asset use permissionYou are allowed to use the assets in this file without permission as long as you credit me
Asset use permission in mods/files that are being soldYou are not allowed to use assets from this file in any mods/files that are being sold, for money, on Steam Workshop or other platforms
Asset use permission in mods/files that earn donation pointsYou are allowed to earn Donation Points for your mods if they use my assets
Author notes
This author has not provided any additional notes regarding file permissions
File credits
This author has not credited anyone else in this file
Donation Points system
This mod is opted-in to receive Donation Points
Changelogs
Version 1.0
Base Version Created
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
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.