Skip to content

Customization

ConnerWill edited this page Mar 29, 2023 · 10 revisions

Using a Different Package Manager

This script is setup to use yay as the package manager.

However, it is very easy to change and use a different package manager

To use a different package manager, edit the yayfzf file and replace yay with the the package manager you wish to use (see below)

    ##-------- OPTIONS --------##
    packages_sort_by="votes"
    use_color="always"
    detailedPreview="yay --sync --info --info --verbose --color $use_color "
    installPackage="yay --sync --verbose --color $use_color --nobatchinstall --confirm"
    ##-------------------------##

Remove/replace any options to suite your desired package manager. Replace installPackage with the command to install a package. Replace detailedPreview with the command to view extra details about the package. ​

In this example, I replaced the commands to suite pacman. pacman doesnt have the --sortby flag. So I removed it. pacman also doesnt have the --nobatchinstall flag, to it was removed from the installer command

    ##-------- OPTIONS --------##
    packages_sort_by=""
    use_color="always"
    detailedPreview="pacman --sync --info --verbose --color $use_color "
    installPackage="pacman --sync --verbose --color $use_color --confirm"
    ##-------------------------##

NOTE

In the future I intend to adapt the script to be compatible with other distros/package managers.


Colors

FZF Colors

To use different colors for fzf, edit the yayfzf file and modify the fzf colors using hexidecimal as shown below

  ## fzf colors
  ## Set environment variable 'yayfzf_colortheme' to a list of fzf colors to override default theme below
  if [[ -z "${yayfzf_colortheme}" ]]; then
    yayfzf_colortheme="hl:italic:#FFFF00,hl+:bold:underline:#FF0000"
    yayfzf_colortheme="${yayfzf_colortheme},fg:#98A0C5,fg+:bold:underline:#FFFFFF"
    yayfzf_colortheme="${yayfzf_colortheme},bg:#13172A,bg+:#0F1222"
    yayfzf_colortheme="${yayfzf_colortheme},border:#75A2F7,label:bold:#75A2F7"
    yayfzf_colortheme="${yayfzf_colortheme},preview-fg:bold:#C0CAF5,preview-bg:#0F1222"
    yayfzf_colortheme="${yayfzf_colortheme},marker:#00FF00,gutter:#0F1222,pointer:#FF0000"
    yayfzf_colortheme="${yayfzf_colortheme},query:#FF0000,info:italic:#98A0C5,spinner:#00FFFF,header:italic:#75A2F7"
  fi

Other Colors

To use different colors, edit the yayfzf file and modify the yay colors using ANSI Escape Sequences as shown below

  ## yay colors
  COLOR_WHEN="always"
  ## yayfzf colors
  yayfzf_color[Reset]='\x1B[0m'              # Reset Colors/Styles
  yayfzf_color[reset]='\x1B[0m'              #
  yayfzf_color[Bold]='\x1B[1m'               # Bold style
  yayfzf_color[bold]='\x1B[1m'               #
  yayfzf_color[Italic]='\x1B[3m'             # Italic style
  yayfzf_color[italic]='\x1B[3m'             #
  yayfzf_color[Underline]='\x1B[4m'          # Underline style
  yayfzf_color[underline]='\x1B[4m'          #
  yayfzf_color[Black]='\x1B[38;5;0m'         # Foreground color
  yayfzf_color[Gray]='\x1B[38;5;245m'        #
  yayfzf_color[DarkGray]='\x1B[38;5;8m'      #
  yayfzf_color[White]='\x1B[38;5;15m'        #
  yayfzf_color[Red]='\x1B[38;5;196m'         #
  yayfzf_color[Green]='\x1B[38;5;46m'        #
  yayfzf_color[Yellow]='\x1B[38;5;190m'      #
  yayfzf_color[Blue]='\x1B[38;5;33m'         #
  yayfzf_color[Purple]='\x1B[38;5;93m'       #
  yayfzf_color[Magenta]='\x1B[38;5;201m'     #
  yayfzf_color[Cyan]='\x1B[38;5;87m'         #
  yayfzf_color[BG_Black]='\x1B[48;5;0m'      # Background color
  yayfzf_color[BG_Gray]='\x1B[48;5;245m'     #
  yayfzf_color[BG_DarkGray]='\x1B[48;5;8m'   #
  yayfzf_color[BG_White]='\x1B[48;5;15m'     #
  yayfzf_color[BG_Red]='\x1B[48;5;196m'      #
  yayfzf_color[BG_Green]='\x1B[48;5;46m'     #
  yayfzf_color[BG_Yellow]='\x1B[48;5;190m'   #
  yayfzf_color[BG_Blue]='\x1B[48;5;33m'      #
  yayfzf_color[BG_Purple]='\x1B[48;5;93m'    #
  yayfzf_color[BG_Magenta]='\x1B[48;5;201m'  #
  yayfzf_color[BG_Cyan]='\x1B[48;5;87m'      #

No Colors

yayfzf respects the environment variable NO_COLOR

Setting this environment variable will disable the use of color

Here is an example of setting the NO_COLOR environment variable:

export NO_COLOR=1
Clone this wiki locally