How to change the markup color for acetate

Last Updated: Release 4.3

Issue/Question

I'd like to change the pen color for drawing markups in acetate, how do I do this?

Solution

The markup color of a tool in acetate is originally determined by the default service-side color provider. This color provider automatically assigns a markup color to a client session when that client joins; it is also responsible for assigning a different color to each client in a collaboration scenario.

There are several ways to override the default color provider:

  • You can write a custom service-side color provider. Let's say you notice that the first client to connect to your service always draws markup in red and the second client always draws in yellow, and so on, you can implement a custom provider so that the first client always draws markup in blue, the second client always draws in green, etc.

    To do this, use the ISessionDefaultColorProvider interface. This interface only defines a single method, GetSessionDefaultColor which takes in a Guid. By implementing this in a given class, you can define a method which will assign a specific PureWeb color to a specific session. Once this is done, you simply call SetSessionDefaultColorProvider on the service-side CollaborationManager with an instance of your new object. This color will be then assigned when a new session connects.

  • You can make an API call on the client to override the value automatically assigned by the service-side color provider. This is the method you would use to ensure that the markup color on a client is always the same, regardless of whether the client joins the session first, second, or last.

    To do this, call pureweb.getFramework().getCollaborationManager().setDefaultColor(color); where color is an instance of pureweb.PureWebColor (which itself is constructed with an RGBA hex color code).

  • You can define an acetate tool so that it always draws in a specific color, regardless of the color assigned by the service-side color provider, or set as the default on the client. This is only possible when you are creating your own custom tool.

    To write a custom acetate tool, you implement a class that conforms to the AcetateToolDelegate interface. This interface defines an optional draw() method, which takes a default color parameter that sets the color of the acetate markup generated by the tool.

API References

Click the links below to see the API reference that describes these methods in more detail for your programming language.

For creating a custom color provider on the service:

For creating a custom acetate tool on the client:

 

April 11, 2017