New themes
This commit is contained in:
parent
b8b109ce57
commit
54fc8d49a7
1 changed files with 274 additions and 129 deletions
237
spp.pl
237
spp.pl
|
@ -8,10 +8,11 @@ use utf8;
|
||||||
use open ':std', ':encoding(UTF-8)';
|
use open ':std', ':encoding(UTF-8)';
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
|
||||||
|
|
||||||
our %CONFIG = (
|
our %CONFIG = (
|
||||||
# LAYOUT
|
# LAYOUT
|
||||||
# - Theme and local overrides
|
# - Theme and local overrides
|
||||||
layout_theme => 'powerline_yb' ,
|
layout_theme => 'ascii_yb' ,
|
||||||
layout_theme_overrides => {} ,
|
layout_theme_overrides => {} ,
|
||||||
# - Section generators for the left side of the top bar
|
# - Section generators for the left side of the top bar
|
||||||
layout_left => [
|
layout_left => [
|
||||||
|
@ -47,7 +48,7 @@ our %CONFIG = (
|
||||||
|
|
||||||
# CURRENT WORKING DIRECTORY
|
# CURRENT WORKING DIRECTORY
|
||||||
# - Max width as a percentage of the terminal's width
|
# - Max width as a percentage of the terminal's width
|
||||||
cwd_max_width => 35 ,
|
cwd_max_width => 50 ,
|
||||||
|
|
||||||
# USER@HOST
|
# USER@HOST
|
||||||
# - Display username? 0=no, 1=yes
|
# - Display username? 0=no, 1=yes
|
||||||
|
@ -98,55 +99,23 @@ our %CONFIG = (
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# THEMES
|
# THEMES
|
||||||
|
|
||||||
our %THEMES = ();
|
|
||||||
|
|
||||||
sub thref { bless {(@_==2)?(t=>$_[0],r=>$_[1]):(r=>$_[0])}, 'ThemeRef'; }
|
sub thref { bless {(@_==2)?(t=>$_[0],r=>$_[1]):(r=>$_[0])}, 'ThemeRef'; }
|
||||||
|
|
||||||
# Powerline based, using yellow and blue
|
sub init_themes
|
||||||
$THEMES{powerline_yb} = {
|
{
|
||||||
# Padding character
|
my %t = ();
|
||||||
padding => ' ' ,
|
|
||||||
# Left side of top line
|
|
||||||
left_prefix => '\b1 ' ,
|
|
||||||
left_separator => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}" ,
|
|
||||||
left_suffix => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}".' ' ,
|
|
||||||
# Middle of top line
|
|
||||||
middle_prefix => '' ,
|
|
||||||
middle_separator => ' | ' ,
|
|
||||||
middle_suffix => '' ,
|
|
||||||
# Right side of top line
|
|
||||||
right_prefix => '\f2\b0'."\x{e0b2}".'\f1\b2'."\x{e0b2}".'\b1' ,
|
|
||||||
right_separator => '\f2\b0'."\x{e0b2}".'\f1\b2'."\x{e0b2}" ,
|
|
||||||
right_suffix => '\b0 ' ,
|
|
||||||
# Input line
|
|
||||||
input_prefix => '\b1 ' ,
|
|
||||||
input_separator => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}" ,
|
|
||||||
input_suffix => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}".' ' ,
|
|
||||||
# Secondary prompt suffix
|
|
||||||
ps2_suffix => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}".' ' ,
|
|
||||||
|
|
||||||
# Color gradient to use
|
# Elements that are common between most themes
|
||||||
bg0 => 21 , bg1 => 61 , bg2 => 143 , bg3 => 226 ,
|
my %common = (
|
||||||
fg3 => 18 , fg2 => 21 , fg1 => 184 , fg0 => 226 ,
|
|
||||||
# Default foreground color
|
|
||||||
fg => 15 ,
|
|
||||||
|
|
||||||
# Extra colors for transition strings
|
|
||||||
transition => [ 233 ] ,
|
|
||||||
# Default left side colors
|
# Default left side colors
|
||||||
bg_left => 239 ,
|
|
||||||
fg_left => thref( 'fg' ) ,
|
fg_left => thref( 'fg' ) ,
|
||||||
# Default middle colors
|
# Default middle colors
|
||||||
bg_middle => 235 ,
|
|
||||||
fg_middle => thref( 'fg' ) ,
|
fg_middle => thref( 'fg' ) ,
|
||||||
# Default right side background color
|
# Default right side colors
|
||||||
bg_right => thref( 'bg_left' ) ,
|
bg_right => thref( 'bg_left' ) ,
|
||||||
fg_right => thref( 'fg' ) ,
|
fg_right => thref( 'fg' ) ,
|
||||||
# Default input prompt background color
|
# Default input prompt colors
|
||||||
bg_input => 238 ,
|
|
||||||
fg_input => thref( 'fg' ) ,
|
fg_input => thref( 'fg' ) ,
|
||||||
# Secondary prompt backaground
|
|
||||||
bg_ps2 => 234 ,
|
|
||||||
|
|
||||||
# Current working directory - Truncation string
|
# Current working directory - Truncation string
|
||||||
cwd_trunc => '…' ,
|
cwd_trunc => '…' ,
|
||||||
|
@ -172,10 +141,8 @@ $THEMES{powerline_yb} = {
|
||||||
pcmd_ok_sym => '✓' ,
|
pcmd_ok_sym => '✓' ,
|
||||||
pcmd_err_sym => '✗' ,
|
pcmd_err_sym => '✗' ,
|
||||||
# Previous command state - OK text / background color
|
# Previous command state - OK text / background color
|
||||||
pcmd_ok_fg => thref( 'fg3' ) ,
|
|
||||||
pcmd_ok_bg => -1 ,
|
pcmd_ok_bg => -1 ,
|
||||||
# Previous command state - Error text / background color
|
# Previous command state - Error text / background color
|
||||||
pcmd_err_fg => thref( 'fg0' ) ,
|
|
||||||
pcmd_err_bg => -1 ,
|
pcmd_err_bg => -1 ,
|
||||||
# Previous command state - Other text foreground
|
# Previous command state - Other text foreground
|
||||||
pcmd_text_fg => -1 ,
|
pcmd_text_fg => -1 ,
|
||||||
|
@ -186,8 +153,8 @@ $THEMES{powerline_yb} = {
|
||||||
load_low_fg => -1 ,
|
load_low_fg => -1 ,
|
||||||
load_low_bg => -1 ,
|
load_low_bg => -1 ,
|
||||||
# Load average - Medium load colors
|
# Load average - Medium load colors
|
||||||
load_med_fg => thref( 'fg1' ) ,
|
load_med_fg => thref( 'fg2' ) ,
|
||||||
load_med_bg => thref( 'bg1' ) ,
|
load_med_bg => thref( 'bg2' ) ,
|
||||||
# Load average - High load colors
|
# Load average - High load colors
|
||||||
load_high_fg => thref( 'fg3' ) ,
|
load_high_fg => thref( 'fg3' ) ,
|
||||||
load_high_bg => thref( 'bg3' ) ,
|
load_high_bg => thref( 'bg3' ) ,
|
||||||
|
@ -234,7 +201,185 @@ $THEMES{powerline_yb} = {
|
||||||
# Python virtual environment section colors
|
# Python virtual environment section colors
|
||||||
pyenv_bg => -1 ,
|
pyenv_bg => -1 ,
|
||||||
pyenv_fg => -1 ,
|
pyenv_fg => -1 ,
|
||||||
|
);
|
||||||
|
|
||||||
|
# Base configuration for the Powerline-based themes below
|
||||||
|
my %powerline = ( %common ,
|
||||||
|
# Padding character
|
||||||
|
padding => ' ' ,
|
||||||
|
# Left side of top line
|
||||||
|
left_prefix => '\b1 ' ,
|
||||||
|
left_separator => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}" ,
|
||||||
|
left_suffix => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}".' ' ,
|
||||||
|
# Middle of top line
|
||||||
|
middle_prefix => '' ,
|
||||||
|
middle_separator => ' | ' ,
|
||||||
|
middle_suffix => '' ,
|
||||||
|
# Right side of top line
|
||||||
|
right_prefix => '\f2\b0'."\x{e0b2}".'\f1\b2'."\x{e0b2}".'\b1' ,
|
||||||
|
right_separator => '\f2\b0'."\x{e0b2}".'\f1\b2'."\x{e0b2}" ,
|
||||||
|
right_suffix => '\b0 ' ,
|
||||||
|
# Input line
|
||||||
|
input_prefix => '\b1 ' ,
|
||||||
|
input_separator => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}" ,
|
||||||
|
input_suffix => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}".' ' ,
|
||||||
|
# Secondary prompt suffix
|
||||||
|
ps2_suffix => '\f0\b2'."\x{e0b0}".'\f2\b1'."\x{e0b0}".' ' ,
|
||||||
|
|
||||||
|
# Extra colors for transition strings
|
||||||
|
transition => [ 233 ] ,
|
||||||
|
# Default left side colors
|
||||||
|
bg_left => 239 ,
|
||||||
|
# Default middle colors
|
||||||
|
bg_middle => 235 ,
|
||||||
|
# Default input prompt color
|
||||||
|
bg_input => 238 ,
|
||||||
|
# Secondary prompt backaground
|
||||||
|
bg_ps2 => 234 ,
|
||||||
|
|
||||||
|
# Previous command state - OK text / background color
|
||||||
|
pcmd_ok_fg => thref( 'fg3' ) ,
|
||||||
|
# Previous command state - Error text / background color
|
||||||
|
pcmd_err_fg => thref( 'fg0' ) ,
|
||||||
|
);
|
||||||
|
# Powerline-based, using yellow and blue
|
||||||
|
$t{powerline_yb} = {
|
||||||
|
%powerline ,
|
||||||
|
# Color gradient to use
|
||||||
|
bg0 => 21 , bg1 => 61 , bg2 => 143 , bg3 => 226 ,
|
||||||
|
fg3 => 18 , fg2 => 21 , fg1 => 184 , fg0 => 226 ,
|
||||||
|
# Default foreground color
|
||||||
|
fg => 15 ,
|
||||||
};
|
};
|
||||||
|
# Powerline-based, using green/yellow/red
|
||||||
|
$t{powerline_gyr} = {
|
||||||
|
%powerline ,
|
||||||
|
bg0 => 2 , bg1 => 10 , bg2 => 11 , bg3 => 9 ,
|
||||||
|
fg3 => 0 , fg2 => 0 , fg1 => 0 , fg0 => 0 ,
|
||||||
|
fg => 15 ,
|
||||||
|
pcmd_ok_fg => 10 , pcmd_ok_bg => -1 ,
|
||||||
|
pcmd_err_fg => 0 , pcmd_err_bg => 9 ,
|
||||||
|
};
|
||||||
|
|
||||||
|
# Base configuration for the unicode box-based themes below
|
||||||
|
my %blocks = ( %common ,
|
||||||
|
# Padding character
|
||||||
|
padding => '─' ,
|
||||||
|
# Left side of top line
|
||||||
|
left_prefix => '\b2\f3╭┄ ' ,
|
||||||
|
left_separator => '\b2\f3 ┈ ' ,
|
||||||
|
left_suffix => '\b2\f3 ┄╢' ,
|
||||||
|
# Middle of top line
|
||||||
|
middle_prefix => ' ' ,
|
||||||
|
middle_separator => ' | ' ,
|
||||||
|
middle_suffix => ' ' ,
|
||||||
|
# Right side of top line
|
||||||
|
right_prefix => '\b2\f3╫┄ ' ,
|
||||||
|
right_separator => '\b2\f3 ┈ ' ,
|
||||||
|
right_suffix => '\b2\f3 ┄(' ,
|
||||||
|
# Input line
|
||||||
|
input_prefix => '\b2\f3╰┄' ,
|
||||||
|
input_separator => '\b2\f3┈' ,
|
||||||
|
input_suffix => '\b2\f3─> ' ,
|
||||||
|
# Secondary prompt suffix
|
||||||
|
ps2_suffix => '\b2\f3┊ ' ,
|
||||||
|
|
||||||
|
# Foreground
|
||||||
|
fg => 7 ,
|
||||||
|
|
||||||
|
# Extra colors for transition strings
|
||||||
|
transition => [ 0 , 7 ] ,
|
||||||
|
# Default left side colors
|
||||||
|
bg_left => 0 ,
|
||||||
|
fg_left => thref( 'fg' ) ,
|
||||||
|
# Default middle colors
|
||||||
|
bg_middle => 0 ,
|
||||||
|
fg_middle => 15 ,
|
||||||
|
# Default right side background color
|
||||||
|
bg_right => 0 ,
|
||||||
|
fg_right => thref( 'fg' ) ,
|
||||||
|
# Default input prompt background color
|
||||||
|
bg_input => 0 ,
|
||||||
|
fg_input => thref( 'fg' ) ,
|
||||||
|
# Secondary prompt backaground
|
||||||
|
bg_ps2 => 0 ,
|
||||||
|
|
||||||
|
# Previous command state - OK text / background color
|
||||||
|
pcmd_ok_fg => thref( 'fg0' ) ,
|
||||||
|
# Previous command state - Error text / background color
|
||||||
|
pcmd_err_fg => thref( 'fg3' ) ,
|
||||||
|
);
|
||||||
|
# Block-based, using green/yellow/red
|
||||||
|
$t{blocks_gyr} = {
|
||||||
|
%blocks ,
|
||||||
|
bg0 => -1 , bg1 => -1 , bg2 => -1 , bg3 => -1 ,
|
||||||
|
fg0 => 2 , fg1 => 10 , fg2 => 11 , fg3 => 9 ,
|
||||||
|
transition => [ 0 , 230 ] ,
|
||||||
|
fg_middle => 230 ,
|
||||||
|
};
|
||||||
|
# Block-based, using yellow/blue
|
||||||
|
$t{blocks_yb} = {
|
||||||
|
%blocks ,
|
||||||
|
bg0 => -1 , bg1 => -1 , bg2 => -1 , bg3 => -1 ,
|
||||||
|
fg0 => 69 , fg1 => 117 , fg2 => 178 , fg3 => 226 ,
|
||||||
|
transition => [ 0 , 189 ] ,
|
||||||
|
fg_middle => 189 ,
|
||||||
|
};
|
||||||
|
|
||||||
|
# ASCII theme, based on the blocks theme
|
||||||
|
my %ascii = (
|
||||||
|
# Padding character
|
||||||
|
padding => '-' ,
|
||||||
|
# Left side of top line
|
||||||
|
left_prefix => '\b2\f3[' ,
|
||||||
|
left_separator => '\b2\f3][' ,
|
||||||
|
left_suffix => '\b2\f3]' ,
|
||||||
|
# Middle of top line
|
||||||
|
middle_prefix => ' ' ,
|
||||||
|
middle_separator => ' | ' ,
|
||||||
|
middle_suffix => ' ' ,
|
||||||
|
# Right side of top line
|
||||||
|
right_prefix => '\b2\f3(' ,
|
||||||
|
right_separator => '\b2\f3|' ,
|
||||||
|
right_suffix => '\b2\f3)' ,
|
||||||
|
# Input line
|
||||||
|
input_prefix => '\b2\f3[' ,
|
||||||
|
input_separator => '\b2\f3][' ,
|
||||||
|
input_suffix => '\b2\f3]> ' ,
|
||||||
|
# Secondary prompt suffix
|
||||||
|
ps2_suffix => '\b2\f3| ' ,
|
||||||
|
|
||||||
|
# Current working directory - Truncation string
|
||||||
|
cwd_trunc => '...' ,
|
||||||
|
# User@host - Remote host symbol
|
||||||
|
uh_remote_symbol => '(r)' ,
|
||||||
|
# Previous command state - Symbols
|
||||||
|
pcmd_ok_sym => ':-)' ,
|
||||||
|
pcmd_err_sym => ':-(' ,
|
||||||
|
|
||||||
|
# Load average - Symbol or text
|
||||||
|
load_title => 'ld ' ,
|
||||||
|
|
||||||
|
# Git - Branch symbol
|
||||||
|
git_branch_symbol => "B " ,
|
||||||
|
# Git - Untracked symbol and colors
|
||||||
|
git_untracked_symbol => 'U ' ,
|
||||||
|
# Git - Indexed symbol and colors
|
||||||
|
git_indexed_symbol => 'I ' ,
|
||||||
|
# Git - Add/modify/delete symbols
|
||||||
|
git_add_symbol => '+' ,
|
||||||
|
git_mod_symbol => '~' ,
|
||||||
|
git_del_symbol => '-' ,
|
||||||
|
# Git stash symbol and color
|
||||||
|
git_stash_symbol => 'S ' ,
|
||||||
|
);
|
||||||
|
$t{ascii_gyr} = { %{ $t{blocks_gyr} } , %ascii };
|
||||||
|
$t{ascii_yb} = { %{ $t{blocks_yb} } , %ascii };
|
||||||
|
|
||||||
|
return %t;
|
||||||
|
}
|
||||||
|
|
||||||
|
our %THEMES = init_themes;
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# MAIN PROGRAM
|
# MAIN PROGRAM
|
||||||
|
@ -642,7 +787,7 @@ sub render_prevcmd
|
||||||
my @out = ();
|
my @out = ();
|
||||||
if ( $ss ) {
|
if ( $ss ) {
|
||||||
push @out , { fg => ( ( $cl & 1 ) != 0 ) ? $col : -1 };
|
push @out , { fg => ( ( $cl & 1 ) != 0 ) ? $col : -1 };
|
||||||
push @out , themed( ( $status == 0 ) ? 'pcmd_ok_sym' : 'pcmd_err_sym' );
|
push @out , themed( $status == 0 ? 'pcmd_ok_sym' : 'pcmd_err_sym' );
|
||||||
}
|
}
|
||||||
if ( $sc ) {
|
if ( $sc ) {
|
||||||
push @out , ' ' if @out;
|
push @out , ' ' if @out;
|
||||||
|
|
Loading…
Reference in a new issue