Message Boards Message Boards

0
|
7647 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Adding Colors to a Graphic

Posted 10 years ago

Hi,

How can I add a background color and a line color for this interactive graphic?

The colors I'm after are, for the lines, RGB 243, 203, 109; HEX F3CB6D , and for the background, RGB 71, 162, 199; HEX 47A2C7

Thanks for any help!

Will

Manipulate[
 DynamicModule[{tt = 
    Table[RandomWalkFn[200, lattice[latttype]], {40}]}, 
  Grid[{{Dynamic[
      RandomWalkHexGraphics[particles, steps, tt]]}, {Button[
      "generate new walk", 
      tt = Table[RandomWalkFn[200, lattice[latttype]], {40}], 
      ImageSize -> 150]}}]],
 {{latttype, 6, "connection angle"}, {3 -> "2\[Pi]/3", 4 -> "\[Pi]/2",
    5 -> "2\[Pi]/5", 6 -> "\[Pi]/3", 7 -> "2\[Pi]/7", 8 -> "\[Pi]/4", 
   9 -> "2\[Pi]/9", 10 -> "\[Pi]/5", 11 -> "2\[Pi]/11", 
   12 -> "\[Pi]/6"}},
 {{particles, 20}, 1, 40, 1, Appearance -> "Labeled"},
 {{steps, 75}, 1, 200, 1, Appearance -> "Labeled"},
 TrackedSymbols :> {latttype, particles, steps},
 Initialization :> (
   SeedRandom[1123];
   lattice[n_] := 
    N[Table[{Cos[(2*Pi*i)/n], Sin[(2*Pi*i)/n]}, {i, 0, n - 1}]];
   RandomWalkFn[n_, tmp_List, startpos_: {0, 0}] := 
    FoldList[Plus, startpos, 
     Table[tmp[[RandomInteger[{1, Length[tmp]}]]], {n}]];
   RandomWalkHexGraphics[particles_, steps_, tt_] := 
    Module[{data}, 
     data = Table[tt[[j]][[i]], {j, 1, particles}, {i, 1, steps}];
     Graphics[{AbsolutePointSize[0.8], AbsoluteThickness[0.3], 
       Line@data}, 
      PlotRange -> {{Min[data] - 1, Max[data] + 1}, {Min[data] - 1, 
         Max[data] + 1}}, AspectRatio -> Automatic, ImageSize -> 400]];
   )]
Attachments:
POSTED BY: Greg
2 Replies
Posted 10 years ago

Looks great. I see how that works. Thanks!

POSTED BY: Greg
Posted 10 years ago

Please look at this,I've added a few to your code that can help you get the color that you want to

try

POSTED BY: Luis Ledesma
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract