Jump to content

Needs HTML Color

Not a Bug 1.0.2

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}";
            }

 

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
2.3m
Total downloads
Customers
10.7k
Customers served
Files Sold
154.6k
Marketplace sales
Payments
3.3m
Processed total
×
×
  • 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.