Jump to content

Needs HTML Color

Not a Bug 1.0.2

RustMaker
RustMaker

Posted

Color options need to be in html color code format (ex: #08FF00) instead of RGB so that they're more easily changeable.

NubbbZ

Posted

Changed Status from Pending to Not a Bug

NubbbZ

Posted

I get your point but no, because then the opacity is gone.

  • Administrator
Death

Posted

On 6/2/2021 at 2:15 PM, NubbbZ said:

I get your point but no, because then the opacity is gone.

Here's the method I use to accept either an RGBA or hex while still allowing an opacity to be specified.

            public static string Color(string hexColor, float alpha)
            {
                if (hexColor.StartsWith("#"))
                    hexColor = hexColor.Substring(1);
                int red = int.Parse(hexColor.Substring(0, 2), NumberStyles.AllowHexSpecifier);
                int green = int.Parse(hexColor.Substring(2, 2), NumberStyles.AllowHexSpecifier);
                int blue = int.Parse(hexColor.Substring(4, 2), NumberStyles.AllowHexSpecifier);
                return $"{(double)red / 255} {(double)green / 255} {(double)blue / 255} {alpha}";
            }

 

1.6m

Downloads

Total number of downloads.

7.7k

Customers

Total customers served.

115.4k

Files Sold

Total number of files sold.

2.3m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.