-
Notifications
You must be signed in to change notification settings - Fork 2
Colors
When many people work in the same page, usage in collaborative editors is to give some visual feedback of the activity of the other users. One way is to draw one cursor per collaborating user showing where her cursor is located on her own screen: this is where deletions or insertions occurs. Another way is to highlight insertions with a distinctive color for each user, and this is what colorg currently does.
This is not much sophisticated in the current Emacs client for colorg: in particular, deletions occur without any feedback about who is deleting text, and there is no explicit identification of who is associated with a particular highlighting color.
For each collaborator, only the most recently inserted text fragment is highlighted, these are not accumulated. One one hand, it might be interesting for a user to revise all contributed text coming from a particular collaborator, or for all of them; on the other hand, this would imply more commands and machinery to wholly or partly clear those highlights so they do not progressively become an encumbrance.
There are also technical limitations: Emacs may allow for highlights either as text properties or as overlays. If accumulation is done with text properties, the automatic colorization associated with Emacs programming modes would take over, either completely obliterating colorg highlighting, or leaving a mess out of the mix. If accumulation is done with overlays, we need as many overlays as there are text fragments, and Emacs slows down when there are many overlays.
Currently, there is one overlay per collaborating user, and this overlay is used to highlight the last bit of inserted text from that collaborator.
If the need often arises to revise modifications made by collaborators, one may take the habit of keeping the edited files under revision control (which is a good habit for other reasons as well), and then use Emacs facilities to list differences between the working copy and the last committed state. While not an ideal solution, it might be workable enough.
Colors are chosen automatically. There is no current way for the user to chose which color is to be associated with a particular collaborator. Nor there is a way for a collaborator to chose the color by which she wants to be seen on the other screens.
Who should decide of the color associated with a collaborator on my editing screen? The advantage of a collaborator choosing her color is the ability of identify herself to others by color instead of by name, over the phone or in other chat windows. The advantage of letting me decide is that it increases the chance to have more distinct colors between contributors, or just because I might prefer some colors and dislike others.
Short of offering configuration windows for colors, colorg uses mild heuristic to chose colors. Really picking an optimal set of visually distinct colors is hard: it implies optimization problems in CIE color space, combined with legibility considerations. Using a preset, limited list of colors is quite workable: the number of collaborating users in a buffer is always going to be small in practice. However, an algorithmic, unbounded solution may be more elegant, at least if it short enough to program.
As the color selection is nothing critical, we avoided perceptual vision considerations, difficult color models, tessellation issues, etc. We merely tried something simple, based on the debatable HSV system. To maintain text legibility, colorg uses only pastel colors for the background, with identical high intensity and low saturation settings. To get contrasted hues, we use the nice distribution properties for the integral part of the successive multiples of the golden ratio. Moreover, because color tastes differ, we avoid sticking to a single color set: each time colorg starts, a new random bias is computed, which is then added to all hues, so preserving the contrasting virtues. This randomness may be inhibited by presetting the colorg-hue-bias variable to a constant value between 0.0 and 1.0 (excluded).