Hello dear users,
I'm actually coding a little program with processing.
My problem is, that I have a color-bar. I choose some color out of this bar with my left mouse button.
This value is saved in a variable of the "color" type with this function:
Code:color value = get(mouseX, mouseY);
Now I'm able to make an output of this selected hex-value:
Code:println("Original Hex Value: " + hex(value));
gives this back: Original Hex Value: FF4700FF
I don't really know, why i go 8 characters back, because the important value is just "4700FF". THIS is the hex value of the color i selected.
Now I try to describe what I want to do with this value.
For example:
Original Hex Value: #4700FF
I want to "modify" this value with some kind of "right rotation".
The first modified value should look this this: #FF4700 and the second one #00FF47.
I need this operations to get a "Triadic Color Harmony" but I'm not able to do this "rotation step".
I tried already the following things:
1. I made a new variable of String type:
Code:String hex = "#"+hex(value,6);
2. Made a new String out of the the original value:
Code:String rotatedHex = hex.substring(5) + hex.substring(1,5);
3. Did a String to Integer convert:
Code:komp_wert1 = (Integer.valueOf(rotatedHex,16).intValue());
4. Some println():
Code: println("Original Hex: " + hex(value));
println("OriginalHex as String: " + hex);
println("Rotierted Hex: " + rotatedHex);
5. Terminal output:
Code:Original Hex: FFB700FF
Original Hex as String: #B700FF
Rotierted Hex: FFB700
Can anybody bring me a little light to solve this problem?
Thanks in advance!
Mike