commit 727c1cbf17be3a968d15758d0d33c60c1aec3b51 Author: ronny abraham Date: Mon May 5 16:06:10 2025 +0300 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..11d6db4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,103 @@ +# Created by https://www.toptal.com/developers/gitignore/api/vim,emacs,osx +# Edit at https://www.toptal.com/developers/gitignore?templates=vim,emacs,osx + +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +### OSX ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# End of https://www.toptal.com/developers/gitignore/api/vim,emacs,osx diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/bin/install.sh b/bin/install.sh new file mode 100644 index 0000000..fa48e6d --- /dev/null +++ b/bin/install.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +target="$HOME/.bashrc" + +config_dir="$HOME/.config/prompt-theme" +config_file="$config_dir/config.yaml" +source_line="source $config_dir/bin/prompt-theme.sh" + +if ! grep -Fxq "$source_line" "$target"; then + echo "$source_line" >> "$target" + echo "✅ Added prompt-theme to $target" +else + echo "ℹ️ prompt-theme is already sourced in $target" +fi + +# copy default config file if none exists +if [[ ! -f "$config_file" ]]; then + cp "$config_dir/share/_config.yaml" "$config_file" +else + echo "ℹ️ Existing config.yaml found at $config_file (unchanged)" +fi diff --git a/bin/prompt-theme.sh b/bin/prompt-theme.sh new file mode 100755 index 0000000..36eaa4d --- /dev/null +++ b/bin/prompt-theme.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +#config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +config_dir="$HOME/.config/prompt-theme/" +config_file="$config_dir/config.yaml" +shell_colors="$config_dir/dircolors" + +# Accept theme as CLI arg, fallback to config +theme="$1" + +# if no parameter given, look for default in config.yaml +# use 'yq' to parse the config.yaml file + +# Ensure yq is installed +if ! command -v yq >/dev/null 2>&1; then + echo "⚠️ Warning: 'yq' is not installed. Cannot parse $config_file." + return 0 +fi + +# If no theme given, attempt to get it from config +if [[ -z "$theme" && -f "$config_file" ]]; then + theme=$(yq '.default' "$config_file") +fi + +# Fail silently if no theme could be determined +if [[ -z "$theme" ]]; then + echo "⚠️ Warning: No theme specified and no default set in config file." + return 0 +fi + +# Determine which dircolors command to use +# give a warning and fail silently if not found +if [[ "$(uname)" == "Darwin" ]]; then + if command -v gdircolors >/dev/null 2>&1; then + dircolors_cmd="gdircolors" + else + echo "❌ Error: gdircolors not found. Please install via 'brew install coreutils'." + return 0 + fi +else + if command -v dircolors >/dev/null 2>&1; then + dircolors_cmd="dircolors" + else + echo "❌ Error: dircolors not found. Please install coreutils." + return 0 + fi +fi + +# Apply dircolors theme or fallback +if [[ -r "$shell_colors/$theme" ]]; then + eval "$($dircolors_cmd -b "$shell_colors/$theme")" +elif [[ -r "$HOME/.dircolors" ]]; then + eval "$($dircolors_cmd -b "$HOME/.dircolors")" +else + echo "⚠️ Warning: No readable dircolors file found for '$theme' or ~/.dircolors. Using default ls colors." +fi + +# get prompt from config.yaml if available +if [[ -f "$config_file" ]]; then + prompt=$(yq ".prompts.$theme" "$config_file") +else + prompt="" +fi + +# apply prompt or fallback +if [[ -n "$prompt" && "$prompt" != "null" ]]; then + export PS1="$prompt" +else + echo "⚠️ Warning: No prompt found for theme '$theme'. Using fallback." + export PS1='\[\033[01;34m\]\u@\h \[\033[01;32m\]\w\[\033[00m\] \$ ' +fi + diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..6e2ec2a --- /dev/null +++ b/config.yaml @@ -0,0 +1,8 @@ +default: bone + +prompts: + default: '\[\033[01;34m\]\u@\h \[\033[01;32m\]\w\[\033[00m\] \$ ' + bone: '\[\033[38;5;250m\]\u@\h \[\033[38;5;160m\]\w\[\033[0m\] \$ ' + nature: '\[\033[38;5;100m\]\u@\h \[\033[38;5;65m\]\w\[\033[0m\] \$ ' + ayu-mirage: '\[\033[38;5;179m\]\u@\h \[\033[38;5;110m\]\w\[\033[0m\] \$ ' + diff --git a/dircolors/ayu-mirage b/dircolors/ayu-mirage new file mode 100644 index 0000000..aee4ca5 --- /dev/null +++ b/dircolors/ayu-mirage @@ -0,0 +1,103 @@ +# ayu-mirage dircolors +# Custom dircolors for Ronny + +TERM xterm-256color + +# Normal text +NORMAL 00 +FILE 00 +DIR 01;38;5;110 +LINK 01;38;5;180 +SYMLINK 01;38;5;180 +FIFO 38;5;240 +SOCK 38;5;243 +BLK 38;5;179 +CHR 38;5;179 +ORPHAN 38;5;124 +MISSING 38;5;124 + +# Executables +EXEC 01;38;5;215 + +# Archives +.7z 38;5;174 +.tar 38;5;174 +.tgz 38;5;174 +.tbz 38;5;174 +.tbz2 38;5;174 +.txz 38;5;174 +.zip 38;5;174 +.rar 38;5;174 +.gz 38;5;174 +.bz2 38;5;174 +.xz 38;5;174 +.zst 38;5;174 +.lzma 38;5;174 +.lzo 38;5;174 +.apk 38;5;174 + +# Images +.jpg 38;5;139 +.jpeg 38;5;139 +.png 38;5;139 +.gif 38;5;139 +.bmp 38;5;139 +.svg 38;5;139 +.webp 38;5;139 +.tiff 38;5;139 +.xcf 38;5;139 + +# Audio +.mp3 38;5;109 +.wav 38;5;109 +.flac 38;5;109 +.ogg 38;5;109 +.opus 38;5;109 +.m4a 38;5;109 + +# Video +.mp4 38;5;109 +.mkv 38;5;109 +.mov 38;5;109 +.webm 38;5;109 +.avi 38;5;109 + +# Code & Config +.sh 01;38;5;215 +.py 01;38;5;151 +.js 01;38;5;151 +.ts 01;38;5;151 +.rs 01;38;5;151 +.go 01;38;5;151 +.c 01;38;5;151 +.cpp 01;38;5;151 +.h 01;38;5;151 +.hpp 01;38;5;151 +.html 01;38;5;109 +.css 01;38;5;182 +.scss 01;38;5;182 +.json 01;38;5;109 +.yaml 01;38;5;109 +.yml 01;38;5;109 +.toml 01;38;5;109 +.ini 01;38;5;109 +.conf 01;38;5;109 +.env 01;38;5;109 +.lock 38;5;240 + +# Docs +.md 38;5;182 +.txt 38;5;182 +.rst 38;5;182 +.pdf 38;5;182 +.doc 38;5;182 +.docx 38;5;182 +.odt 38;5;182 + +# Backups, logs, junk +*~ 38;5;240 +.bak 38;5;240 +.old 38;5;240 +.log 38;5;240 +.swp 38;5;240 +.tmp 38;5;240 diff --git a/dircolors/bone b/dircolors/bone new file mode 100644 index 0000000..9b26579 --- /dev/null +++ b/dircolors/bone @@ -0,0 +1,77 @@ +# Configuration for LS_COLORS: Theme = Bone Expanded +TERM xterm-256color +RESET 0 + +# Directories and Links +DIR 38;5;180 # pale tan bone +LINK 01;38;5;181 # slightly pinkish clay (symbolic links) +SYMLINK 01;38;5;181 +ORPHAN 01;38;5;124 # warning red for broken links + +# Executables and Permissions +EXEC 01;38;5;144 # muted green-grey ivory +SETUID 37;41 +SETGID 30;43 +STICKY_OTHER_WRITABLE 36;40 + +# Devices and Pipes +FIFO 38;5;245 # dull pipe-gray +SOCK 38;5;248 # slightly warmer socket tone +BLK 38;5;146 # chalk +CHR 38;5;146 + +# Archives +.tar 38;5;137 # old dusted rose +.tgz 38;5;137 +.zip 38;5;137 +.7z 38;5;137 +.rar 38;5;137 +.gz 38;5;137 +.bz2 38;5;137 +.xz 38;5;137 +.zst 38;5;137 + +# Text & Config Files +.txt 38;5;250 # dry bone +.md 38;5;251 # pale parchment +.conf 38;5;145 # old wall paint +.ini 38;5;145 +.yaml 38;5;145 +.yml 38;5;145 +.json 38;5;145 +.env 38;5;145 + +# Source Code +.py 38;5;180 # clean structure +.js 38;5;182 # ash-ivory green +.ts 38;5;182 +.sh 38;5;143 # antique olive +.bash 38;5;143 +.html 38;5;181 # soft clay +.css 38;5;180 # bone-yellow +.scss 38;5;180 +.java 38;5;145 # structural beige +.cpp 38;5;145 +.c 38;5;145 +.go 38;5;109 # dry plant green +.rs 38;5;95 # deep ochre + +# Media Files +.jpg 38;5;139 # warm desaturated photo +.jpeg 38;5;139 +.png 38;5;139 +.svg 38;5;139 +.gif 38;5;139 +.mp4 38;5;174 # soft highlight red +.webm 38;5;174 +.mp3 38;5;146 # polished bone +.wav 38;5;146 +.ogg 38;5;146 +.flac 38;5;146 + +# Backup & Temp +*~ 38;5;245 +.bak 38;5;245 +.swp 38;5;245 +.tmp 38;5;245 +.old 38;5;245 diff --git a/dircolors/nature b/dircolors/nature new file mode 100644 index 0000000..984442d --- /dev/null +++ b/dircolors/nature @@ -0,0 +1,77 @@ +# Configuration for LS_COLORS: Theme = Nature Expanded +TERM xterm-256color +RESET 0 + +# Directories and Links +DIR 38;5;114 # leafy green +LINK 01;38;5;180 # bark/twig brown (symbolic/hard links) +SYMLINK 01;38;5;180 +ORPHAN 01;38;5;124 # decayed red-brown for broken links + +# Executables and Permissions +EXEC 01;38;5;142 # mossy yellow-green +SETUID 37;41 +SETGID 30;43 +STICKY_OTHER_WRITABLE 36;40 + +# Devices and Pipes +FIFO 38;5;95 # earth pipe – muted red clay +SOCK 38;5;101 # underground stone blue +BLK 01;38;5;137 # light bark +CHR 01;38;5;137 + +# Archives +.tar 38;5;131 # dusty red-brown +.tgz 38;5;131 +.zip 38;5;131 +.7z 38;5;131 +.rar 38;5;131 +.gz 38;5;131 +.bz2 38;5;131 +.xz 38;5;131 +.zst 38;5;131 + +# Text & Config Files +.txt 38;5;106 # fresh leaf +.md 38;5;108 # stem green +.conf 38;5;109 # spring leaf +.ini 38;5;109 +.yaml 38;5;109 +.yml 38;5;109 +.json 38;5;109 +.env 38;5;109 + +# Source Code +.py 38;5;113 # python ivy +.js 38;5;150 # soft moss +.ts 38;5;150 +.sh 38;5;142 # shell ferns +.bash 38;5;142 +.html 38;5;180 # warm bark +.css 38;5;179 # golden straw +.scss 38;5;179 +.java 38;5;108 # jungle trunk +.cpp 38;5;108 +.c 38;5;108 +.go 38;5;107 # damp forest floor +.rs 38;5;94 # rich soil + +# Media Files +.jpg 38;5;138 # treebark +.jpeg 38;5;138 +.png 38;5;138 +.svg 38;5;138 +.gif 38;5;138 +.mp4 38;5;173 # sunset orange +.webm 38;5;173 +.mp3 38;5;109 # melodic green +.wav 38;5;109 +.ogg 38;5;109 +.flac 38;5;109 + +# Backup & Temp +*~ 38;5;240 +.bak 38;5;240 +.swp 38;5;240 +.tmp 38;5;240 +.old 38;5;240 diff --git a/share/_config_yaml b/share/_config_yaml new file mode 100644 index 0000000..dde8676 --- /dev/null +++ b/share/_config_yaml @@ -0,0 +1,8 @@ +default: ayu-mirage + +prompts: + default: '\[\033[01;34m\]\u@\h \[\033[01;32m\]\w\[\033[00m\] \$ ' + bone: '\[\033[38;5;250m\]\u@\h \[\033[38;5;160m\]\w\[\033[0m\] \$ ' + nature: '\[\033[38;5;100m\]\u@\h \[\033[38;5;65m\]\w\[\033[0m\] \$ ' + ayu-mirage: '\[\033[38;5;179m\]\u@\h \[\033[38;5;110m\]\w\[\033[0m\] \$ ' +