added color customization by nadr0 · Pull Request #188 · algorithm-visualizer/algorithm-visualizer · GitHub
Skip to content

added color customization#188

Merged
64json merged 1 commit into
algorithm-visualizer:masterfrom
nadr0:more-colors
Jun 19, 2016
Merged

added color customization#188
64json merged 1 commit into
algorithm-visualizer:masterfrom
nadr0:more-colors

Conversation

@nadr0

@nadr0 nadr0 commented Jun 19, 2016

Copy link
Copy Markdown
Contributor

The coders are able to set the tracer’s colors to anything they want!
Since I use the style background color attribute on the div it can
accept a wide variety of values for the background color.

I first wanted to pass in some color value when calling notify or
select but then I realized there is a lot of issues with the amount of
parameters. So I thought of doing some sort of global set like the
HTML canvas/context does.

Tracer now has 5 new methods for setting the colors.
_set(name)FillColor(color_goes_here).

Valid color formats (must be passed in as strings):

  • "#ffffff" (hex)
  • "orange" (name)
  • "rgb(255,0,0)" (rgb)

The logic of setting/using the fillColor methods should be similar to the canvas/context fillStyle. It will keep using that color until the color is switched again.

Example:
tracer._select( j )._wait(); // default background color
tracer._setSelectFillColor('orange') // will be orange until changed
tracer._select( k )._wait(); // orange background color

I had to change the clear method inside array2d.js also to handle the
new coloring change.

The coders are able to set the tracer’s colors to anything they want!
Since I use the style background color attribute on the div it can
accept a wide variety of values for the background color.

I first wanted to pass in some color value when calling notify or
select but then I realized there is a lot of issues with the amount of
parameters . So I thought of doing some sort of global set like the
HTML canvas/context does.

Tracer now has 5 new methods for setting the colors.
_Set(name)FillColor(color_goes_here).

The logic of the setting fillColor and it being displayed should be
similar to the canvas/context fillStyle setting. It will keep using
that color until the color is switched again.

I had to change the clear method inside array2d.js also to handle the
new coloring change.
@64json 64json merged commit bfb9c3d into algorithm-visualizer:master Jun 19, 2016
@nadr0 nadr0 deleted the more-colors branch June 19, 2016 22:24
64json added a commit that referenced this pull request Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants