-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom Bash Prompt? #2
Comments
Here's the initial prompt I've come up with. Works for me. Seems errorless. #!/usr/bin/env bash
# Colors
black="\[$(tput setaf 0)\]"
red="\[$(tput setaf 1)\]"
green="\[$(tput setaf 2)\]"
yellow="\[$(tput setaf 3)\]"
blue="\[$(tput setaf 4)\]"
magenta="\[$(tput setaf 5)\]"
cyan="\[$(tput setaf 6)\]"
white="\[$(tput setaf 7)\]"
# Title bar - "user@host: ~"
title="\u@\h: \w"
titlebar="\[\033]0;"$title"\007\]"
# Git branch
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)\ /';
}
# Clear attributes
clear_attributes="\[$(tput sgr0)\]"
# Custom bash prompt - "➜ ~ (master) "
export PS1="${titlebar}${green}➜ ${blue}\W ${cyan}\$(git_branch)${clear_attributes}" I worked on this for a little while with some of the minute details and I'm happy with it, however, it'd be cool if there were defined colors for other stuff too. Like maybe git for instance. I've seen in the preview image over here that git is colored, and commands like "cd" are colored as well. Also, the underlining. I'm not personally sure how to customize all of that right away, but it'd be cool if someone shared that if they have already done this. Just trying to use Dracula in a bash prompt the way it looks ultimately in that preview image. No idea if these git colors are accurate, but I stole it from someone else who was also using Dracula.
|
This is a great help. Thanks for sharing @barryanders |
How did you get the green arrows for each beginning lines of commands? |
You can see the arrow in the export PS1 line. It's just written plainly. |
excellent! yo😁 |
Please forgive the elementary question, but how do I define the remaining colors in the Dracula Theme palette (for my bash profile)? For example, I noticed pink and orange are missing from the color definitions above. |
@barrymode How to configure git and Linux commands? |
@icn2you 0-7 are the only color options, and the color names are chosen based on what that traditionally represents. On any command line I've ever used, it's always 0 = black This repo includes a basic profile with the colors set https://github.com/dracula/terminal.app/blob/master/Dracula.terminal I only added custom bash prompt code above because I wanted it to look the way they showed it on their website. To my understanding, it's not possible to add additional colors as the color limitations are part of the command line itself. It's likely possible to add more color to different outputs of your prompt, however, I'm not familiar with it. I just know the basics. @huangboju Add this to
As for Linux commands, I don't know. Maybe you mean something like this? I use this for forcing color output on various commands. You can add this to
|
@barrymode THX |
Closing this since the discussion is a few months old and not 100% relevant to the Terminal.app theme. Anyone have thoughts on converting it to a wiki page so that it's more accessible? |
Real quick, was just curious if there is already a custom bash prompt available. I looked around and couldn't find one so I started making my own. However, it's incomplete and I thought there's no point in continuing if someone else already made it. Otherwise, I'll keep working on it.
The text was updated successfully, but these errors were encountered: