Skip to content
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

added new theme (lambda) #2235

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

added new theme (lambda) #2235

wants to merge 3 commits into from

Conversation

w453y
Copy link

@w453y w453y commented Dec 1, 2023

[Pull Request] New Bash Theme: Lambda

Description

I've created a new Bash theme named "Lambda". This theme provides a clean and visually appealing command line prompt. Below, I briefly explain the configuration file and its elements.

Configuration File

function set_prompt {
    local user_color="\[\033[1;31m\]"  # bold red for username
    local at_color="\[\033[1;37m\]"    # bold white for @ symbol
    local host_color="\[\033[1;31m\]"  # bold red for hostname
    local in_color="\[\033[1;37m\]"    # bold white for "in"
    local dir_color="\[\033[1;35m\]"   # bold purple for current working directory
    local git_color="\[\033[1;36m\]"   # bold cyan for Git information
    local time_color="\[\033[1;32m\]"  # bold green for time taken
    local reset_color="\[\033[0m\]"    # reset color
    local prompt_symbol_color="\[\033[1;31m\]"  # bold red for the prompt symbol

    local end_time=$(date +%s%3N)  # current time in milliseconds
    local time_taken=$(( (end_time - start_time) ))  # time in milliseconds

    PS1="${user_color}╭─\\u"  # username
    PS1+="${at_color}@${host_color}\\h"  # @ symbol and hostname
    PS1+="${in_color} in"  # "in" between hostname and current directory
    PS1+="${dir_color} \\w"  # current working directory

    # Git information (status symbol)
    PS1+=" ${git_color}$(__git_ps1 "[%s]")${reset_color}"

    if [ $time_taken -gt 0 ]; then
        PS1+=" ${time_color}took ${time_taken}ms"  # time taken in milliseconds
    fi

    PS1+="\n${prompt_symbol_color}╰─λ${reset_color} "  # red color for the prompt symbol, reset color after
}

PROMPT_COMMAND='start_time=$(date +%s%3N); set_prompt'

Additional Information

  • The theme uses color-coded elements for user, hostname, current directory, Git information, and time taken ( by cpu to execute that command ).
  • Git information includes the current branch in square brackets.
  • The time taken is displayed in milliseconds if it exceeds 0.

Screenshots

I have added a screenshot of the "Lambda" theme in action to the docs/images folder in the gh-pages branch. Please refer to the Themes page for a preview.

Note to Maintainers

Kindly review the changes and provide feedback. I am open to any adjustments or improvements to ensure compatibility and consistency with the Bash-it project. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant