.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "11_demos\itom\basics\demo_ansiEscapeSequencesOutput.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_11_demos_itom_basics_demo_ansiEscapeSequencesOutput.py: ANSI escape codes =================== This demo shows some possibilities of ANSI escape codes. .. GENERATED FROM PYTHON SOURCE LINES 7-8 Change the text color .. GENERATED FROM PYTHON SOURCE LINES 10-11 set the text colors to pre-defined values, followed by a reset .. GENERATED FROM PYTHON SOURCE LINES 11-14 .. code-block:: Python print("\u001b[30m A \u001b[31m B \u001b[32m C \u001b[33m D \u001b[0mText after reset") print("\u001b[34m E \u001b[35m F \u001b[36m G \u001b[37m H \u001b[0mText after reset") .. rst-class:: sphx-glr-script-out .. code-block:: none A B C D Text after reset E F G H Text after reset .. GENERATED FROM PYTHON SOURCE LINES 15-16 use the prefix 1 to choose are more lighter text color .. GENERATED FROM PYTHON SOURCE LINES 16-23 .. code-block:: Python print( "\u001b[30;1m A \u001b[31;1m B \u001b[32;1m C \u001b[33;1m D \u001b[0mText after reset" ) print( "\u001b[34;1m E \u001b[35;1m F \u001b[36;1m G \u001b[37;1m H \u001b[0mText after reset" ) .. rst-class:: sphx-glr-script-out .. code-block:: none A B C D Text after reset E F G H Text after reset .. GENERATED FROM PYTHON SOURCE LINES 24-25 now the same with the background color .. GENERATED FROM PYTHON SOURCE LINES 25-34 .. code-block:: Python print("\u001b[40m A \u001b[41m B \u001b[42m C \u001b[43m D \u001b[0mText after reset") print("\u001b[44m E \u001b[45m F \u001b[46m G \u001b[47m H \u001b[0mText after reset") print( "\u001b[40;1m A \u001b[41;1m B \u001b[42;1m C \u001b[43;1m D \u001b[0mText after reset" ) print( "\u001b[44;1m E \u001b[45;1m F \u001b[46;1m G \u001b[47;1m H \u001b[0mText after reset" ) .. rst-class:: sphx-glr-script-out .. code-block:: none A B C D Text after reset E F G H Text after reset A B C D Text after reset E F G H Text after reset .. GENERATED FROM PYTHON SOURCE LINES 35-36 use text bold, underline, italic or combine them .. GENERATED FROM PYTHON SOURCE LINES 36-40 .. code-block:: Python print( "\u001b[1;3;4mText bold, underline and italic \u001b[22mRemove bold only " "\u001b[23;1mRemove italic and set bold again \u001b[0mReset all" ) .. rst-class:: sphx-glr-script-out .. code-block:: none Text bold, underline and italic Remove bold only Remove italic and set bold again Reset all .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.009 seconds) .. _sphx_glr_download_11_demos_itom_basics_demo_ansiEscapeSequencesOutput.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_ansiEscapeSequencesOutput.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: demo_ansiEscapeSequencesOutput.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: demo_ansiEscapeSequencesOutput.zip `