I'm not sure it's a bug or not, but... When I edit a document as single user, the Color in postMessage View_Added is a number 411298. I expect this to be hex value of css color. So, if I add '#' to it and use it on the page it looks violet/blue-ish. However, in the editor window where users are listed I see a black rectangle near by "You" label: <td class="usercolor" style="background-color: #000;"></td> So, either the editor displays wrong color or it is not a hex color value.
I guess this is java color specification. I found how to convert it to hex in javascript: color = ((color)>>>0).toString(16).slice(-6); color = '#' + ("000000").substring(0, 6 - color.length) + color; I'm not 100% sure this is correct. Still, this is javascript API, so maybe you could use color in appropriate format. Still, the color is different than the td.usercolor (which is black).
(In reply to Aleksander Machniak from comment #1) > I guess this is java color specification. I found how to convert it to hex > in javascript: These are RGB integer values directly fed to loleaflet by LO core. > > color = ((color)>>>0).toString(16).slice(-6); > color = '#' + ("000000").substring(0, 6 - color.length) + color; > > I'm not 100% sure this is correct. Yes, that is the correct way to convert. We convert it similarly in loleaflet too. > Still, the color is different than the td.usercolor (which is black). The color is explicitly set to black in case of current user, overwriting the value that you noticed in View_Added message so that it matches with the user's cursor which is black. LO core assigns each author a separate color and the value that you get in View_Added message is this same value. This is used in Change Tracking UI (coming soon ...), and comments. You can notice that the background color of comment box is same as of this value. Don't think would be a good idea to overwrite this value with black for current user as we/you might need it in future, but maybe we can add another postmessage API that let you know the viewid of the current user (?) [or maybe integrate the same in those editor init. message ?]
(In reply to Pranav Kant from comment #2) > > color = ((color)>>>0).toString(16).slice(-6); > > color = '#' + ("000000").substring(0, 6 - color.length) + color; > > > > I'm not 100% sure this is correct. > > Yes, that is the correct way to convert. We convert it similarly in > loleaflet too. Maybe it would be good to have it already converted so any client-side code don't have to do it? > > Still, the color is different than the td.usercolor (which is black). > > The color is explicitly set to black in case of current user, overwriting > the value that you noticed in View_Added message so that it matches with the > user's cursor which is black. LO core assigns each author a separate color > and the value that you get in View_Added message is this same value. This is > used in Change Tracking UI (coming soon ...), and comments. You can notice > that the background color of comment box is same as of this value. Don't > think would be a good idea to overwrite this value with black for current > user as we/you might need it in future, but maybe we can add another > postmessage API that let you know the viewid of the current user (?) [or > maybe integrate the same in those editor init. message ?] Yeah, I found out it's the cursor color value. I think we can leave it as is.
Putting back to NEW as there's no assignee to this bug
Pranav Kant committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/online/commit/?id=073b58269b1fd63f946f3b7ba7b8b11754e5092c tdf#103673 - Use hex color value in API