sverweij / mscgen_js

text => sequence charts
https://mscgen.js.org
GNU General Public License v3.0
206 stars 25 forks source link

Text labels are slightly translucent #229

Closed Lightborne closed 8 years ago

Lightborne commented 8 years ago

All text labels are slightly translucent. See this example input.

a,b,c;

a note a : a note a\n(note),
b box b  : b box b\n(action);
a rbox a : a rbox a\n(reference),
b abox b : b abox b\n(state/ condition);

a -> c : [label="This one too"];

If you look closely, the vertical lines for A and C can be seen through all of the text labels.

Can text labels be made 100% opaque?

sverweij commented 8 years ago

You've got sharp eyes!

Since then (2013 ...) I have redone the wrapping algorithm, and occlusion happens a lot less, even with autowrap=on, so I'd like to try what happens when the translucency is switched off. The change is fairly trivial, but I need some time to publish it - I'll share the url in an update

... out of curiosity: => What is the reason you want labels to be 100% opaque?

example of text occlusion

a =>> b: "First line.\nSecond line; occludes.\nThird line.";

occlusion

Lightborne commented 8 years ago

I see! Thanks for the explanation. It's a feature, not a bug! :-)

My personal preference is to minimize opacity in all of my diagrams. I think that it hurts readability. For example, in the image you posted, I can understand your rationale for making the text label translucent but I think the arrow flow is just as understandable if the label covered it completely, since the arrow is perfectly horizontal.

I do concede that if you use arcgradient != 0, the translucency could help. Again, it just comes down to personal preference!

I'm not usually one to like software with tons of options, but perhaps something like this could be done?

msc {

   # default label opacity of 10% can be overrideen by user
   defaultlabelopacity=100; # 0-100, as a percentage

   # Colors accept an optional alpha channel that overrides all defaults 

   # White box, completely transparent
   A box A [label="abox", textbgcolour="#ffffff00"]; 

   # Red box, Completely opaque 
   A box A [label="rbox", textbgcolour="#ff0000ff"];

   # green box, 50% opacity
   A box A [label="note", textbgcolour="#00ff0080"];

   # blue box, default
   A box A [label="note", textbgcolour="#0000ff"];

}
sverweij commented 8 years ago

I've published a feature branch where the default opacity of everything but watermarks is 100%, just to get a feel of how it looks: ~sverweij.github.io/mscgen_js/branches/feature/opacify/index.html~ - let me know what you think.

msc {
   # default label opacity of 10% can be overriden by user
   # defaultlabelopacity=100; # 0-100, as a percentage

   # Colors accept an optional alpha channel that overrides all defaults 
   A;

   # White box, completely transparent
   A box A [label="abox", textbgcolour="transparent"]; 

   # Red box, Completely opaque 
   A box A [label="rbox", textbgcolour="rgba(255, 0, 0, 1)"];

   # green box, 50% opacity
   A box A [label="note", textbgcolour="rgba(0, 255, 0, 0.5)"];

   # blue box, default
   A box A [label="note", textbgcolour="rgba(0, 0, 255, 0.9)", textcolour="white"];
}

Which renders like so: translucency

(Edit 2016-11-26 removed the link to the deployed feature branch as it's no longer there)

sverweij commented 8 years ago

@Wargazm I've been using the 100% opaque version for a few days - and it's a keeper. Thanks for bringing it to my attention.

I've updated mscgenjs-core to reflect this, and updated all stuff using it (in page package, on line interpreter, command line interface, atom package) - so you'll be able to use it as of now.

Enjoy!

Lightborne commented 8 years ago

Fantastic! I'll update all my documents tomorrow.

Thanks so much for being so prompt and attentive.