Jump to content
Sign in to follow this  
jacmac

500 Color Constants + Alpha Variants

Recommended Posts

Color Constants Download

Color List

I have procedurally converted the 500 colors on the Color List above into a .hpp file. Here is a sample (except the tabs are lined up in the file on 4 spaces per tab):

#define ARRAY_ALICEBLUE										[0.94,0.97,1,1]	
#define ARRAY_ALICEBLUE_HALF								[0.94,0.97,1,0.5]	
#define ARRAY_ALICEBLUE_OPAQUE								[0.94,0.97,1,0.75]	
#define ARRAY_ALICEBLUE_PART								[0.94,0.97,1,0.25]	
#define COLOR_ALICEBLUE										{0.94,0.97,1,1}	
#define COLOR_ALICEBLUE_HALF								{0.94,0.97,1,0.5}	
#define COLOR_ALICEBLUE_OPAQUE								{0.94,0.97,1,0.75}	
#define COLOR_ALICEBLUE_PART								{0.94,0.97,1,0.25}	
#define HTMLCOLOR_ALICEBLUE									'#F0F8FF'
#define RGB_ALICEBLUE										"'#F0F8FF'"	

As you can see with the ARRAY and COLOR prefixes, there are four alpha versions for each color.

  • Like 1

Share this post


Link to post
Share on other sites

Very nice! I'm sure it will be usefull to a lot of people out there!

Thank you sir! ;)

Share this post


Link to post
Share on other sites
Very nice! I'm sure it will be usefull to a lot of people out there!

Thank you sir! ;)

Oh yes it will! :D Thank you for doing that.

I'll combine it with my colouring-script that gives each vehicle of a kind a specific colour:

colorinit.sqf:

//colour changes to all vehicles of a kind:
//call with:
/*
coloroptions = compileFinal preProcessFileLineNumbers "scripts\coloractions.sqf";
[] execVM "scripts\colorinit.sqf";
*/
[] spawn {
   while {true} do {
       {
           {
               if (isNil {_x getVariable "ItemIsColored"}) then {
                   [_x, "coloroptions", true, true] call BIS_fnc_MP;
                   _x setVariable ["ItemIsColored", true, false];
               };
               sleep 0.001;
           }forEach allMissionObjects _x;
           sleep 0.001;
       }forEach [
	"A",
	"LIST",
	"OF",
	"THE",
	"VEHICLES",
	"TO",
	"BE",
	"COLOURED"
	];
   }; 
};

coloroptions.sqf:

if !(isServer) exitWith {false};
_vehicle = _this;

_actID = _vehicle setObjectTexture [0,'#(rgb,8,8,3)color(PUTYOURCOLOURHERE)'];
_actID = _vehicle setObjectTexture [1,'#(rgb,8,8,3)color(PUTYOURCOLOURHERE)'];
_actID = _vehicle setObjectTexture [2,'#(rgb,8,8,3)color(PUTYOURCOLOURHERE)'];

Share this post


Link to post
Share on other sites

very handy for GUI's.. thx for this.

Share this post


Link to post
Share on other sites

The download link takes me to a page with 2 shiny "download" buttons. One wants me to install some off-beat "flash" program. The other takes me to blank page with various popups. Would it be viable to upload the file to dropbox or the like? Thanks.

Share this post


Link to post
Share on other sites

Great work! Just a warning, this post is not meant to overshadow your work, I just want to explain a little about Arma's color system.

So as we know, Arma uses the RGBA color system that stands for RedGreenBlueAlpha. In RGB and RGBA, 8 bits are used for colors, meaning a total of 256 shades (0 - 255). That decimal number is then converted to hexadecimal (like what you see when you want to color words in your forum posts, for example)

You can very clearly see this if you color some words in the forum:

#FF0000

#00FF00

#0000FF

However, in the arma engine, you define colors using an RGBA array such as {0,0,0,0}, where 0 represents no color, and 1 represents maximum color. For example, the same colors as above would be represented as:

{1,0,0,1}

{0,1,0,1}

{0,0,1,1}

What does this mean? Well that means it's actually extremely simple to go to any RGB color picker website, such as this (just some random website) and convert the colors to use in Arma.

Let's take Brown for example (#663300) (I didn't use the forum color picker btw, I manually wrote the forum code so I'm not sure if it'll show up properly). Now you have 3 elements here, the red element, the green element, and the blue element (RGB) all in hex so you need to convert that to decimal. Hexadecimal is the same as binary, except, instead of counting 1 then resetting that bit and incrementing another one, hexadecimal can count all the way from 0 to 15. Now, obviously 15 uses two digits, so it's actually more accurate to say that hexadecimal can count from 0 to 9 and A to F (A-F representing 10,11,12,13,14,15). Anyway, back to our conversions:

HEX = DECIMAL

66 = 102

33 = 51

00 = 0

Alpha would obviously be at the maximum in this case (which is 255)

So now we have an array that looks like this {102, 51, 0, 255} but wait, this isn't very useful because it can't be read by Arma!

Don't worry, this is the easiest step in the entire ordeal, all you have to do is divide each number by the maximum value (again, which is 255, FF = 255)

So now you have {0.4, 0.2, 0, 1}, which is brown!

So one last time, not trying to steal your thread, I just wanted everyone to understand how colors work within the engine. I'm not sure you can find any of this information on the wiki other than "Arma uses RGBA"

Enjoy!

EDIT: How to convert hexadecimal to decimal without using an online converter:

Take the first digit and convert it to decimal, then multiply by 16, then take the second digit and convert it to decimal, then add them together. This is an extremely simplified explanation and only covers hex that is 2 digits (FF, for example), but that's all you'll ever need for Arma.

Edited by DreadedEntity
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Sure, people could use a tool that someone else wrote for them (I realize you made this tool), but what's the point if you don't understand the underlying concept? With the information I just posted, people will be able to write their own tool, rather than just use someone else's

Share this post


Link to post
Share on other sites

Then you have to ammend your explanation. HEX colour in Arma is either RGB or ARGB not RGBA.

Edited by Killzone_Kid

Share this post


Link to post
Share on other sites

Thanks I'll check it out. So far I finally found the desired color in normal rgb. I just divided the red, green and blue values each by 255 to get the desired color / values.

Share this post


Link to post
Share on other sites
Then you have to ammend your explanation. HEX colour in Arma is either RGB or ARGB not RGBA.

I'm certain that colors in description.ext (specifically for dialogs) use RGBA format

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×