0

I use the Base16 for Shells scripts to change my shell's default ANSI colors. For instance:

$ wget https://github.com/chriskempson/base16-shell/raw/master/scripts/base16-nord.sh
$ sh base16-nord.sh

That script changes terminal colors from this (I'm using openSUSE Leap 15.1 with GNOME 3.26.2):

enter image description here

To this:

enter image description here

It works not only on GNOME Terminal, but also on any virtual console (e.g. tty1).

But I need to call it every time I start a new terminal window/session, or add a call for it on ~/.bashrc.

The question is: how can I apply that color theme system wide? (so that all users get the same color theme applied)

Most pages out there explain how to customize PS1 or LS_COLORS, those are not what I'm looking for. That's why I started a new question.

5
  • Why are you not following the installation instructions given right in front of you on that very WWW page?
    – JdeBP
    Feb 19, 2020 at 13:15
  • It explains how to set up colors for the current user. I want to set up colors system wide (for all users). Feb 19, 2020 at 13:17
  • Then why does the question make no mention of users, and why is it written in the singular ("every time I start a new")?
    – JdeBP
    Feb 19, 2020 at 13:23
  • I think that "system wide" means "all users". It's written on the title and on the text. If you would like to suggest a better redaction, please edit the question. Feb 19, 2020 at 14:00
  • Okay, sorry, I edited the text myself. Mar 12, 2020 at 18:22

1 Answer 1

0

I found a way of applying the same Base16 Shell theme system wide (to all users). But I do believe there is a better way of doing that. Suggestions would be really appreciated.

  1. Download Base16 Shell to a folder accessible to all users (e.g. /usr/share/base16-shell/)
$ sudo git clone https://github.com/chriskempson/base16-shell.git /usr/share/base16-shell/
  1. The system wide equivalent to ~/.bashrc is /etc/bash.bashrc.local.

Create the file /etc/bash.bashrc.local if necessary.

Append the following to it:

# Base16 Shell
BASE16_SHELL="/usr/share/base16-shell/"
[ -n "$PS1" ] && \
    [ -s "$BASE16_SHELL/profile_helper.sh" ] && \
        eval "$("$BASE16_SHELL/profile_helper.sh")"
  1. In /etc/skel (the skeleton for new users homes), create a symlink to the theme to be applied by default:
$ sudo ln -s /usr/share/base16-shell/scripts/base16-material-darker.sh /etc/skel/.base16_theme
  1. Create a new user (on openSUSE, you do this using the YaST Control Center)

  2. Log in to the new user and open GNOME Terminal. You should see that theme applied:

enter image description here

Tested using the openSUSE Leap 15.2 Beta GNOME live image.

Notes:

  1. Since we worked in /etc/skel, the theme is going to be applied to new users only (users created after that procedure). Existing users need to call Base16 Shell (just once) to get the theme applied. But, as I said, I believe there is a better way of doing that...
  2. AFAIK /etc/bash.bashrc.local applies to all users (both existing and new ones), so Base16 Shell actually gets setup for all users. Everyone can invoke Base16 Shell scripts to change their themes, if they want. For instance:
$ base16_material-lighter
  1. I used GNOME Terminal as example, but it works for virtual consoles too (e.g. tty1 - Ctrl + Alt + F1). But on virtual consoles I observe a strange behavior:

enter image description here

Colors are applied only after logging in, and are not applied full screen.

Then I run:

$ clear

And everything looks fine:

enter image description here

(for this screenshot, the clear command does not appear, and I ran ll again)

With another theme to make the issue more visible:

enter image description here

Then clear, then ll again:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .