Help with colors

i am doing stuff with java turtles and it doesn't come with certain colors. Can anyone help me find a way to make new colors by using the rgb with the numbers 0 - 255 and that stuff
[189 byte] By [rbabloa_229a] at [2007-11-27 4:01:43]
# 1
http://java.sun.com/javase/6/docs/api/java/awt/Color.html
DrLaszloJamfa at 2007-7-12 9:06:27 > top of Java-index,Java Essentials,New To Java...
# 2

> i am doing stuff with java turtles and it doesn't

> come with certain colors. Can anyone help me find a

> way to make new colors by using the rgb with the

> numbers 0 - 255 and that stuff

What do you need to know? There are lots of color charts, and it isn't so hard to learn how to mix R, G, B so that you get the color that you want.

Kaj

kajbja at 2007-7-12 9:06:27 > top of Java-index,Java Essentials,New To Java...
# 3
A small chart: http://html-color-codes.com/
kajbja at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 4
Color wow = new Color(200, 190, 10);
abillconsla at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 5
>So where would i use that? >In Turtle.java, the colors are defined >BLUE = Turtle.blue;>So would i just put >WOW = Turtle.wow; >according to your example?
rbabloa_229a at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 6
> Color wow = new Color(200, 190, 10);That's a rather turtle-y green.
DrLaszloJamfa at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 7
<Ok i'm very new to java so could you ><show me a code example for what i want?>
rbabloa_229a at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 8
Could you show us a code example of what you are doing?I think you may have better luck at a "turtle" forum. I suspect your codeis using a "turtle" library that few of us know.
DrLaszloJamfa at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 9

public class Turtle extends Object

{public static final double DEGREE = Math.PI / 180;

public static final int WIDTH = 760, HEIGHT = 600;

public static final Color RED = Color.red, BLUE = Color.blue,

BLACK = Color.black,GRAY = Color.gray,

YELLOW = Color.yellow,PINK = Color.pink,

ORANGE = Color.orange,GREEN = Color.green,

MAGENTA = Color.magenta, WHITE = Color.white,

LIGHT_GRAY = Color.lightGray,

TURTLE_GREEN = Color.darkGreen;

Color darkGreen = new Color(22, 114, 41);

that is the code from Turtle.java and i'm trying to figure out how to make a Dark Green where I can switch to it by doing

turtleName.switchTo(Turtle.DARK_GREEN);

rbabloa_229a at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 10
turtleName.switchTo(Turtle.DARK_GREEN);Since you called your variable darkGreen, I guees the above line causes a sompiler error.
floundera at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 11
> > Color wow = new Color(200, 190, 10);> > That's a rather turtle-y green.Oddly, I was not even thinking "turtle" when I coded that - stream of consciousness is what it was ;o)
abillconsla at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 12

public class Turtle extends Object

{ public static final double DEGREE = Math.PI / 180;

public static final int WIDTH = 760, HEIGHT = 600;

public static final Color RED = Color.red, BLUE = Color.blue,

BLACK = Color.black, GRAY = Color.gray,

YELLOW = Color.yellow, PINK = Color.pink,

ORANGE = Color.orange, GREEN = Color.green,

MAGENTA = Color.magenta, WHITE = Color.white,

LIGHT_GRAY = Color.lightGray,

TURTLE_GREEN = Color.darkGreen;

Color darkGreen = new Color(22, 114, 41);

that is the code from Turtle.java and i'm trying to figure out how to make a Dark Green where I can switch to it by doing

turtleName.switchTo(Turtle.DARK_GREEN);

Answer: Make it:

Color DARK_GREEN = new Color(22, 114, 41);

abillconsla at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...
# 13

Notice that those colors are a long string of "constant" definitions.

I would prefer to write them individually:

...

public static final Color TURTLE_GREEN = Color.GREEN;

public static final Color DARK_GREEN = new Color(22, 114, 41);

DrLaszloJamfa at 2007-7-12 9:06:28 > top of Java-index,Java Essentials,New To Java...