Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Bug specifying text color in diagram annotation

Bug specifying text color in diagram annotation


Here's the source code for the Modelica.Blocks.Interfaces.RealOutput connector (with Documentation html removed so as not to screw up the source displayed in this post):

connector RealOutput = output Real "'output Real' as connector" annotation (
  defaultComponentName="y",
  Icon(
    coordinateSystem(preserveAspectRatio=true,
      extent={{-100.0,-100.0},{100.0,100.0}}),
      graphics={
    Polygon(
      lineColor={0,0,127},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})}),
  Diagram(
    coordinateSystem(preserveAspectRatio=true,
      extent={{-100.0,-100.0},{100.0,100.0}}),
      graphics={
    Polygon(
      lineColor={0,0,127},
      fillColor={255,255,255},
      fillPattern=FillPattern.Solid,
      points={{-100.0,50.0},{0.0,0.0},{-100.0,-50.0}}),
    Text(
      lineColor={0,0,127},
      extent={{30.0,60.0},{30.0,110.0}},
      textString="%name")})));

The diagram for this connector displays fine. If you change the lineColor value in the Diagram's Text to the word Black, the diagram disappears. However, if you use the word textColor instead of lineColor (and leave the value as the word Black) the diagram reappears as expected. Note that the diagram looks fine if you use the word lineColor or textColor so long as its value is an actual color tuple (eg {0,0,0}).

Coming from the graphics world, I never understand why colors for such graphic languages as this define RGB color models in such a way that is so tied to the underlying (hardware) color model. A more abstract RGB color model less tied to the implementation would use real numbers for each primary component in the range [0,1].  Adding additional fixed names for the common colors (primaries, secondaries) like Red would be a welcome addition.

There are 0 guests and 0 other users also viewing this topic
You are here: