Reputation:
This question probably sounds silly but I need a serious answer. I am trying to set the background color to a dark red or maroon color. The standard colors do not include the red I need.
I have tried crimson and maroon they do not work. I looked up the java standard colors and they do not include a dark red is there away to create a dark red.
this.gamePanel.setBackground(Color.RED);
The problem is not the code it works perfectly fine. I am in need of a way to get a darker Red for the back ground if possible.
Upvotes: 0
Views: 437
Reputation: 12268
You can create a Color object using any RGB value. So you could change it to
this.gamePanel.setBackground(new Color(128, 0, 0));
or whatever RGB value fits your need. You don't have to use the predefined color instances (like RED, CYAN, BLACK, or whatever).
There are docs for the Java 8 version of the class here that show a lot of options that are available for creating different color instances.
Upvotes: 3