Importing Custom Colours

Game Maker Supports a basic set of colors, but you might want or need to add your own. Doing this is not at all difficult. But people that don’t use any good graphical editors wouldn't know about these tricks.

First, it is important to note that all colors in computers are composed of three primary colors; red, green and blue. These three values could be added up (with a special algorithm) to make a single color value.

Anyway, a color which Game Maker lacks (and which is a favourite of my own) is orange. Let’s import it into GM as the constant c_orange. We'll start by using Game Maker's internal graphical editor. So create a new sprite (or edit an existing one - don't worry we won't change the sprite). Next edit its first image and select the preferred color (orange) by first double-clicking the color square beneath 'left'. Next you may need to click 'Define Custom Colors »' if the button isn’t disabled. After selecting the color in the dialog, get a piece of paper (or run Notepad) and write the numeric values in the boxes after 'Red:', 'Green:' and 'Blue'. Make sure you recognize the numbers afterwards. Next, run Game Maker in debug mode (F6) and in the Debug/Watch Window add the following text/code: make_color_rgb(red,green,blue) but don't forget to replace red, green and blue with the corresponding values we found above. Next, write down the resulting value (the text in the 2nd column) as you did before.

Lastly, open your GM project that you want to add c_orange to and go to the Global Game Settings. Then, go to the Constants tab and click on the first cell in the first column and write c_orange In the 2nd column cell write the last value we found above.

To test this out, create a new project and add c_orange as we did above. Then create a new room and go to the Settings tab and click 'Creation Code', in the code editor, write background_color=c_orange Note that c_orange should be colored just like GM's constants. Running the program will show an empty, orange room.