Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Colour text.

chosen1_kingjichosen1_kingji Posts: 13Member
how to change the colour of text in output?

Comments

  • zibadianzibadian Posts: 6,349Member
    : how to change the colour of text in output?
    :
    In Text mode you can use TextColor() and TextBackground() from the Crt unit. In Graphics mode use the SetColor() and SetBackground() from the Graphs unit.
  • chosen1_kingjichosen1_kingji Posts: 13Member
    : : how to change the colour of text in output?
    : :
    : In Text mode you can use TextColor() and TextBackground() from the Crt unit. In Graphics mode use the SetColor() and SetBackground() from the Graphs unit.
    :
    for example

    if i want to display 'apple' in red
    what should i do?
  • zibadianzibadian Posts: 6,349Member
    : : : how to change the colour of text in output?
    : : :
    : : In Text mode you can use TextColor() and TextBackground() from the Crt unit. In Graphics mode use the SetColor() and SetBackground() from the Graphs unit.
    : :
    : for example
    :
    : if i want to display 'apple' in red
    : what should i do?
    :
    First you set the color using TextColor(). Then you write the word 'apple'. The two units have the color names defined as constants. So the complete code would be:
    [code]
    TextColor(Red);
    Write('Apple');
    [/code]
    The help files contain more info on the color constants and TextColor().
Sign In or Register to comment.