You are not logged in.

#26 2017-09-01 06:47:51

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: setcolors - Change your Linux VT color palette (at boot time too!)

recently i've been having problems with the method outlined in post #15.
in about 90% of all cases, i would get an error message during early boot: 'invalid color: color 0' or something to that effect, and the colorscheme would not be applied to the tty.
the weirdest thing, every now and it WOULD work.
no errors during mkinitcpio.
i had this line in /etc/mkinitcpio.conf:

HOOKS="consolefont colors base udev autodetect modconf block filesystems keyboard fsck"

moving colors to the last position:

HOOKS="consolefont base udev autodetect modconf block filesystems keyboard fsck colors"

fixes things, and i'm still getting the new color scheme very early during the boot process (in fact i don't perceive any difference, timewise).

using linux-lts kernel.

Offline

#27 2017-09-02 06:45:15

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: setcolors - Change your Linux VT color palette (at boot time too!)

^ unfortunately this is not fixed.
the position of the hook in mkinitcpio.conf does not seem to matter (tried first and last).

I am still sometimes getting the error "Color 0: invalid color" during early boot (and the color scheme is not applied).

testing various color schemes, it seems that this happens when Color_0 starts with or contains a 0 (zero), e.g. "COLOR_0=090300" - changing that to "COLOR_0=100300" fixes the problem.
but the color "000000" does not trigger the error.
it also seems that only COLOR_0 triggers the error, and it doesn't matter whether it comes first in /etc/vconsole.conf or not.

of course I always run 'mkinitcpio -p linux-lts' after editing /etc/vconsole.conf.

right now, I'm using atelierdune.dark color scheme from the examples in the github repo, but i had to change the first color (20201d) to make it work.
my /etc/vconsole.conf looks like this:

KEYMAP=fi
FONT=ter-powerline-v16n

COLOR_0=1F1F1F
COLOR_1=d73737
COLOR_2=60ac39
COLOR_3=cfb017
COLOR_4=6684e1
COLOR_5=b854d4
COLOR_6=1fad83
COLOR_7=a6a28c
COLOR_8=7d7a68
COLOR_9=d73737
COLOR_10=60ac39
COLOR_11=cfb017
COLOR_12=6684e1
COLOR_13=b854d4
COLOR_14=1fad83
COLOR_15=fefbec

also see https://github.com/EvanPurkhiser/mkinit … s/issues/3

Last edited by ondoho (2017-09-12 05:35:11)

Offline

#28 2017-09-11 17:25:05

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: setcolors - Change your Linux VT color palette (at boot time too!)

i was barking up the wrong tree.

i may have found something in /usr/lib/initcpio/install/colors - the COLORS variable is not initialized with an empty string.

after adding this:

diff -c /usr/lib/initcpio/install/colors /usr/lib/initcpio/install/colors-new
*** /usr/lib/initcpio/install/colors	2017-09-11 20:13:44.186328524 +0300
--- /usr/lib/initcpio/install/colors-new	2017-09-11 20:13:03.097470560 +0300
***************
*** 3,9 ****
      # subshell to avoid namespace pollution
      (
          [[ -s /etc/vconsole.conf ]] && . /etc/vconsole.conf
! 		
          for COLOR_ID in $(seq 0 15)
          do
              COLOR=$(eval "echo \$COLOR_${COLOR_ID}")
--- 3,11 ----
      # subshell to avoid namespace pollution
      (
          [[ -s /etc/vconsole.conf ]] && . /etc/vconsole.conf
! 
!         COLORS=""
! 
          for COLOR_ID in $(seq 0 15)
          do
              COLOR=$(eval "echo \$COLOR_${COLOR_ID}")
***************
*** 24,30 ****
      add_runscript
      add_binary "/usr/bin/setcolors"
  }
! 	
  help() {
      cat <<HELPEOF
  This hook will setup the console colors during early user space.
--- 26,32 ----
      add_runscript
      add_binary "/usr/bin/setcolors"
  }
! 
  help() {
      cat <<HELPEOF
  This hook will setup the console colors during early user space.

(some noise in that diff because i removed "empty" tabs as well; the only relevant thing is COLORS="")

i tested with about ten different color schemes, and could not reproduce the issue.
proof: removing that line again, rebuild the initrd, and immediately the error "color 0: invalid color" is there again (and no color scheme applied).

Offline

#29 2017-09-14 17:45:06

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: setcolors - Change your Linux VT color palette (at boot time too!)

it is fixed: https://github.com/EvanPurkhiser/mkinit … b8c8e378d7

my first pull request! yay!

here is a gratuitous preview script (requires imagemagick & feh):

#!/bin/bash

# please adjust to your liking
font="xos4 terminus"
size="14000"

feh="$(which feh 2>/dev/null)"
[[ "$feh" == "" ]] && echo "feh not found in PATH. Can't continue." && exit 1
convert="$(which convert 2>/dev/null)"
[[ "$convert" == "" ]] && echo "convert not found in PATH. Can't continue." && exit 1
sort="$(which sort 2>/dev/null)"
[[ "$sort" == "" ]] && echo "sort not found in PATH. Can't continue." && exit 1
grep="$(which grep 2>/dev/null)"
[[ "$grep" == "" ]] && echo "grep not found in PATH. Can't continue." && exit 1

# can take a list of files, or just one
IFS=$'\n'
for file in $@; do
	if [ ! -r "$file" ] || [ -d "$file" ]; then
		echo "File \"$file\" is not readable or a directory."
	else
		i=0
		while read line; do
			color[i]="${line#*#}"
			color[i]="${color[i]%%[[:space:]]*}"
			((i++))
		done <<<$($grep -E '^[0-9][0-5]?#' "$file" | $sort -h)
		# grep only lines starting with 1-2 digits followed by a '#', sort 0-9, 10-15
		# a little more quality control would have been good here, but meh.

		pangostring="<span font=\"$font\" size=\"$size\"> --- File: $file --- \n"
		for i in {0..15}; do
			pangostring="$pangostring<span background=\"#${color[i]}\" $([[ $i == 7 ]] && echo "foreground=\"#${color[0]}\"")>:Background $i#${color[i]}\n:Foreground"
			for j in {0..15}; do
				[[ "${color[i]}" != "${color[j]}" ]] && pangostring="$pangostring<span foreground=\"#${color[j]}\"> $j#${color[j]}</span>"
			done
			[[ $i != 15 ]] && pangostring="$pangostring\n</span>" || pangostring="$pangostring</span>"
		done
		pangostring="$pangostring</span>"
		( echo -e "\n--- File: $file\n--- Formatted for /etc/vconsole.conf:"; sed 's/^\(.*\)#\(.\{6\}\).*$/COLOR_\1=\2/' "$file" ) &
		$convert -background "#${color[0]}" -fill "#${color[7]}" pango:"$pangostring" png:- \
		| $feh --title "$file" -
	fi
done

Offline

#30 2017-09-14 18:36:25

escondida
Package Maintainer (PM)
Registered: 2008-04-03
Posts: 157

Re: setcolors - Change your Linux VT color palette (at boot time too!)

As a side note, if you want to set only the background but don't much care about the palette as a whole, there is a kernel parameter vt.color. For example, the grub boot stanza...

menuentry 'Arch Linux' {
	set root='hd0,gpt3'
	echo	'Loading Linux kernel...'
	linux	/vmlinuz-linux root=UUID=3f812105-228f-4064-bd3e-80dfc829fe11 rw quiet vt.color=0x70
	echo	'Loading Intel microcode & initial ramdisk...'
	initrd  /intel-ucode.img /initramfs-linux.img
}

...(among other things) sets the console to use black text on a white background.

Offline

Board footer

Powered by FluxBB