• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Changing Font color with script, how to?

Messages
53
Country
germany
Hi, I want to change the fontcolor with script depending on a lvar value.
What I have:

XML:
<?xml version="1.0" encoding="UTF-8"?>
<Gauge Name="BaroDisp">
<Image Name="BaroDisp.bmp"/>
<Element>
<Visible>(L:Avail, number) 1 ==</Visible>


   <Element>
       <Position X="10" Y="12"/>
       <Text X="123" Y="35" Length="6" Fixed="Yes" Font="Digit" FontSize="38" Attributes="Bold" Color="#C86B20" BackgroundColor="transparent" HilightColor="white" Bright="Yes" UseTransparency="Yes">
           <String>%((A:KOHLSMAN SETTING MB, millibars) near)%!4d!</String>
       </Text>
   </Element>

</Element>
</Gauge>

Do I have to use for Color a macro? Or should I use ColorScript if existing?

That is the part I want to combine with the upper TextElement.

XML:
(L:DISPLAY_Rotary, number) 0 == if{ #FF0000 }
(L:DISPLAY_Rotary, number) 1 == if{ #FF0B00 }
(L:DISPLAY_Rotary, number) 2 == if{ #FF1600 }
(L:DISPLAY_Rotary, number) 3 == if{ #FF2000 }
(L:DISPLAY_Rotary, number) 4 == if{ #FF2B00 }

Can someone give me a hint, please?
 
Code:
  <Element>
    <Position X="22" Y="162"/>
    <FormattedText X="210" Y="66" Luminous="Yes" Font="glassga"
         Tabs="0,120C" Color="0xD0D0D0" FontSize="26" Adjust="left" >
    <Color Value="yellow"/>
    <Color Value="Orange"/>
    <Color Value="red"/>
    <Color Value="#0099FF"/>   <!-- Light blue -->
    <String>
      %((L:DISPLAY_Rotary, number) 0 ==)
      %{if}
        %\{clr3}   <!-- clr3  is orange -->
      %{end}
     % your text
      %\{clr1}   <!-- reset color -->

   ... and so on......

    </String>
    </FormattedText>
  </Element>

just an excerpt from a gauge. Adapt it to your needs.
Hope everything is clear..
 
another solution


Code:
        %((L:DISPLAY_Rotary, number))%{case}%{:0}%\{clr1}%{:1}%\{clr2}%{:2}%\{clr3}%{:3}%\{clr4}%{:3}%\{clr5}%{end}%
 
If you use ColorScript, you can dynamically change colors by multiplying each individual channel intensity by any desired factor, and then using the bit shift and bitwise OR operators to combine them into the final BGR color.
 
Hi, I have a solution. Here is what I'm using now:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<Gauge Name="BaroDisp">
<Image Name="BaroDisp.bmp"/>

<Macro Name="DigitColor">%('#9F5810' '#9C5815' '#98591A' '#955A1F' '#915B24' '#8D5B29' '#8A5C2E' '#865D33' '#835D38' '#7F5E3D' '#7B5F42' '#785F47' '#74604C' '#716151' '#6D6256' '#69625B' '#666360' '#626465' '#5F646A' '#5B656F' 20 (L:DISPLAY_Rotary, number) case)</Macro>

<Element>
<Visible>(L:Avail, number) 1 ==</Visible>

   <Element>
       <Position X="10" Y="12"/>
       <Text X="123" Y="35" Length="6" Fixed="Yes" Font="Digit" FontSize="38" Attributes="Bold" Color="@DigitColor" BackgroundColor="transparent" HilightColor="white" Bright="Yes" UseTransparency="Yes">
           <String>%((A:KOHLSMAN SETTING MB, millibars) near)%!4d!</String>
       </Text>
   </Element>

</Element>
</Gauge>
 
Back
Top