Skip to content

Custom color schemes

Justin Hileman edited this page Apr 14, 2018 · 6 revisions

To use a custom color scheme, create a function called bobthefish_colors:

function bobthefish_colors -S -d 'Define a custom bobthefish color scheme'

  # Optionally include a base color scheme
  __bobthefish_colors default

  # Then override everything you want!
  # Note that these must be defined with `set -x`
  set -x color_initial_segment_exit     white red --bold
  set -x color_initial_segment_su       white green --bold
  set -x color_initial_segment_jobs     white blue --bold

  set -x color_path                     black white
  set -x color_path_basename            black white --bold
  set -x color_path_nowrite             magenta black
  set -x color_path_nowrite_basename    magenta black --bold

  set -x color_repo                     green black
  set -x color_repo_work_tree           black black --bold
  set -x color_repo_dirty               brred black
  set -x color_repo_staged              yellow black

  set -x color_vi_mode_default          brblue black --bold
  set -x color_vi_mode_insert           brgreen black --bold
  set -x color_vi_mode_visual           bryellow black --bold

  set -x color_vagrant                  brcyan black
  set -x color_k8s                      magenta white --bold
  set -x color_username                 white black --bold
  set -x color_hostname                 white black
  set -x color_rvm                      brmagenta black --bold
  set -x color_virtualfish              brblue black --bold
  set -x color_virtualgo                brblue black --bold
  set -x color_desk                     brblue black --bold
end

Copy and paste that into a file called bobthefish_colors.fish in your $fish_function_path (probably ~/.config/fish/functions/bobthefish_colors.fish) and replace the color variables with the colors you want.

If you want to use a base color scheme and just tweak a few things, you can change the __bobthefish_colors default line to reference any of the built-in color schemes. Then you can comment out or delete the lines for colors you don't want to override.

To test the output while creating your color scheme, you can run bobthefish_display_colors. To see the built-in color schemes, run bobthefish_display_colors --all :)

Examples

Clone this wiki locally