Browse Source

Agnoster: solarized light variant (#4680)

* agnoster: do not hardcode black foreground.

This would allow easy customization when using light color schemes, like
solarized-light

* agnoster: implement light theme variant

Use same variable as in blinks theme, to detect if solarized theme used
is a light or dark one.
Frederic Crozat 5 years ago
parent
commit
e4d2d27af4
1 changed files with 13 additions and 4 deletions
  1. 13 4
      themes/agnoster.zsh-theme

+ 13 - 4
themes/agnoster.zsh-theme

@@ -16,6 +16,10 @@
 # using it on Mac OS X, [iTerm 2](https://iterm2.com/) over Terminal.app -
 # it has significantly better color fidelity.
 #
+# If using with "light" variant of the Solarized color schema, set
+# SOLARIZED_THEME variable to "light". If you don't specify, we'll assume
+# you're using the "dark" variant.
+#
 # # Goals
 #
 # The aim of this theme is to only show you *relevant* information. Like most
@@ -30,6 +34,11 @@
 
 CURRENT_BG='NONE'
 
+case ${SOLARIZED_THEME:-dark} in
+    light) CURRENT_FG='white';;
+    *)     CURRENT_FG='black';;
+esac
+
 # Special Powerline characters
 
 () {
@@ -101,7 +110,7 @@ prompt_git() {
     if [[ -n $dirty ]]; then
       prompt_segment yellow black
     else
-      prompt_segment green black
+      prompt_segment green $CURRENT_FG
     fi
 
     if [[ -e "${repo_path}/BISECT_LOG" ]]; then
@@ -164,7 +173,7 @@ prompt_hg() {
         st='±'
       else
         # if working copy is clean
-        prompt_segment green black
+        prompt_segment green $CURRENT_FG
       fi
       echo -n $(hg prompt "☿ {rev}@{branch}") $st
     else
@@ -178,7 +187,7 @@ prompt_hg() {
         prompt_segment yellow black
         st='±'
       else
-        prompt_segment green black
+        prompt_segment green $CURRENT_FG
       fi
       echo -n "☿ $rev@$branch" $st
     fi
@@ -187,7 +196,7 @@ prompt_hg() {
 
 # Dir: current working directory
 prompt_dir() {
-  prompt_segment blue black '%~'
+  prompt_segment blue $CURRENT_FG '%~'
 }
 
 # Virtualenv: current working virtualenv