1

I am watching "Building Web APIs with Flask" video on Oreilly from Miguel Grinberg. His terminal is colorful and shows different colors for virtualenv name and git branch name. I want to have the same terminal with the same colors and fonts in my Ubuntu 14.04. How can I do that?

Here is a screenshot from one scene of his video:

enter image description here

6
  • You're looking for coloured prompts that have git branches/virtualenv names? The same colours might be a bit difficult, but the rest can be done.
    – muru
    Sep 10, 2014 at 12:02
  • I don't understand what you mean clearly but I want to have colors assigned to the name of virtualenv that I am using, for example in above picture the virtualenv's name is in gray while the rest of the prompt is cyan and the git branch name is green.
    – mehdix
    Sep 10, 2014 at 12:03
  • @muru Moreover the rest of terminal is also colorful. Look at "application/json" which has color and somehow the terminal colors are like an IDE with syntax highlight.
    – mehdix
    Sep 10, 2014 at 12:05
  • 1
    The line (venv) oreilly ... (master) $ is called a bash prompt. The http command naturally does syntax colouring. The two are independent.
    – muru
    Sep 10, 2014 at 12:07
  • 1
    Look at this answer for a prompt that's close to what you want: stackoverflow.com/a/23410110/2072269
    – muru
    Sep 10, 2014 at 12:09

1 Answer 1

2

The http does syntax coloring naturally.

To set a bash prompt like this one, add the contents of this file to your ~/.bashrc. It is an adaptation of the prompt from this SO answer. I have changed the colours, added couple more colour variables and parentheses.

4
  • There is an error in the provided file. Line 35 should change to: datevar=date +%p if [ -n $datevar ] && [ "$datevar" = "PM" ]; then or something similar, otherwise you will get bash errors while entering git directories.
    – mehdix
    Sep 10, 2014 at 13:07
  • Just for record: The script has more bugs that I was not able to fix. It breaks terminal's history navigation.
    – mehdix
    Sep 10, 2014 at 14:01
  • I have experienced neither problem.
    – muru
    Sep 10, 2014 at 14:32
  • Not every environment is identical to another one.
    – mehdix
    Sep 10, 2014 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .