Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added color customization #188

Merged
merged 1 commit into from Jun 19, 2016
Merged

added color customization #188

merged 1 commit into from Jun 19, 2016

Conversation

nadr0
Copy link
Contributor

@nadr0 nadr0 commented Jun 19, 2016

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.

None yet

2 participants