palcomp(1)

๐Ÿ“ฆ
version 1.7 ยท 2 versions
, in opensuse-leap 16.0

๐Ÿ’– palcomp โ€” palette composer โœจ (thatโ€™s palcomp(1) from hxtools, bestie) ๐Ÿ’–

๐ŸŽ€ NAME ๐ŸŽ€

palcomp โ€” palette composer ๐Ÿ’…

๐Ÿฆ‹ SYNTAX ๐Ÿฆ‹

palcomp [commands...]

โœจ DESCRIPTION โœจ

Okay so palcomp makes palettes for terminals, and the whole vibe is lowkey scientific but also very slay. The big realization is this: programs running inside a terminal that use console_codes(4) to set colors rely on the contrast of the colors produced by a color pairing being proportional to the contrast those two codes have when using the VGA color palette. So for that reason, a mainstay of this program is to operate using a colorspace with perceptual uniformity, i.e. CIELAB/LCh. Iconic behavior, no cap.

Most commands operate on a single palette, but bestie, you can store multiple palettes in memory. The current working palette is called "0" (cf. loadreg/savereg). ๐Ÿซถ

๐Ÿ’… COMMANDS ๐Ÿ’…

b0

Set color 0 to actual black. Thatโ€™s it. Black black. ๐Ÿ–ค

bg

Emit a -bg parameter upon xterm, and use color 0.

blend=pct,name

RGB-blend the current palette with another one. It performs:

output := curpal*(100-pct) + secondpal*pct

pct should be in the range 0..100. Math but make it fashion. ๐Ÿงฎโœจ

ct

Print the 16-color table.

ct256

Print 256-color cubes and tables.

cxl

Print a contrast analysis of the palette based on brightness differences.

cxa

Print a contrast analysis of the palette based on Myndex Advanced Perceptual Contrast Algorithm (APCA W3). Be aware of the Helmholtzโ€“Kohlrausch effect, where certain highly saturated colors appear brighter than their measured luminance would imply; in other words, a color pair might appear more legible than the computed contrast value indicates. ๐Ÿ‘€

eq[=b]

Equalize (equal-space) the lightness values of the paletteโ€™s colors. The b parameter (0 <= b <= 100) specifies the mandatory lightness difference from the darkest to 2nd darkest color. In practice, b specifies the lightness value that blue is to be assigned. If b is absent, uses b=1/16. Cute defaults. ๐ŸŽ€

fg

Emit a -fg parameter upon xterm, and use color 7.

hueadd=h

Rotate colors using LCh space. (0 <= h < 360)

hueset=h

Set the hue of all colors using LCh space.

ild=t

Set the white point to be a series D illuminant at color temperature t. (t should be in the range 4000..25000 K). This only has an effect for the "cxa" command. Commands like hueadd/set/litadd/mul etc. all use libbabl, which hardcodes D65. The default white point used by palcomp is ild=6500. Note that D65 is not exactly 6500 K, due to changes of the Planck constant between when Illuminant D was first defined and 2019. Science lore, iykyk. ๐Ÿ”ฌ

inv16

Perform color inversion the way Norton Icon Editor did it. Retro moment. ๐Ÿ‘‘

lch

Emit the LCh form of the palette to stdout (no particular formatting). Raw beauty. โœจ

litadd=r

Change colorsโ€™ brightness using LCh space.

litmul=r

Multiply colorsโ€™ brightness using LCh space.

litset=r

Set colorsโ€™ brightness using LCh space.

loadpal=

Load RGB palette from a file. xfce4-terminal *.theme files and termux *.properties files are understood. File format detective work: handled. ๐Ÿ”

loadreg=name

Set the working palette ("0") to the contents of the named palette.

satadd=r

Change colorsโ€™ saturation using LCh space.

satmul=r

Multiply colorsโ€™ saturation using LCh space. In effect, with r<1, this causes a desaturation of colors; r=0 leads to gray. Desaturated era. ๐Ÿฉถ

satset=r

Set colorsโ€™ saturation using LCh space.

savereg=name

Save the current working palette ("0") to a new name.

hsltint=h,s,l

Map the (LCh) brightnesses onto a color line through the HSL cylinder that goes from black to the chosen color. Parameter ranges are:

0 <= h < 360
0 <= s < 1
0 <= l <= 1

When using s<=0.5, this produces a black-to-{color} ramp; when using s==1, this produces a black-to-{color}-to-white ramp. Ramp era, honestly. ๐ŸŒˆ

hsltint produces a somewhat more contrasty result than manipulating hue and saturation in LCh. Compare:

  • palcomp vgs satset=100 hueset=120 emit
  • palcomp vgs hsltint=90,1,0.5 emit

hsltint=#rrggbb[,l]

A different syntax for the hsltint operation. First, the RGB value for the tint color is converted to HSL. The so-computed L value can be overridden with the optional ,l suffix. Afterwards, behaves like hsltint=h,s,l. Same slay, different spelling. ๐Ÿ’…

lchtint=h,s,l / lchtint=#rrggbb[,l]

Replace the LCh hue and saturation by the base color given in HSL or RGB. The LCh L value is retained as-is. Keep the lightness, swap the vibe. ๐ŸŽจ

loeq[=b[,g]]

Equalize (equal-space) the lightness values of the paletteโ€™s low-intensity colors plus darkgray. The b parameter (0 <= b <= g <= 100) specifies the mandatory lightness difference from the darkest to 2nd darkest color. In practice, b specifies the lightness value that blue is to be assigned. The g parameter (b <= g <= 100) specifies the lightness that the brightest color of the low-intensity section is to use (in practice, the lightness for grey). If g is absent, defaults to g=88.88; this is so that gray is still a little less intense than white. If b is absent, uses b=11.11. Very specific, very demure. ๐Ÿฉถโœจ

vga

Loads the standard VGA palette.

vgs

Loads a full-saturated VGA palette.

win

Loads the standard Windows palette.

xfce

Emit the palette as a line for an xfce4-terminal theme file.

xterm

Emit the palette as xterm command line options. Use e.g. xterm $(palcomp vga hueset=120 xterm) to utilize. Shell substitution moment. ๐Ÿš

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

Amber tint via LCh color space:

  • palcomp vgs lchtint=#ef951d fg b0 emit

Black-to-green ramp (tint via HSL color space):

  • palcomp vgs hsltint=120,1,0.5 emit
  • palcomp vgs hsltint=#00ff00 emit

Black-to-green-white ramp (tint via HSL color space):

  • palcomp vgs hsltint=120,1,1 emit
  • palcomp vgs hsltint=#00ff00,1 emit

๐Ÿซถ CAVEATS ๐Ÿซถ

Lightness in LCh space behaves a bit counterintuitive. When (saturation) c>0, then L=0 does not mean black, e.g.:

$ palcomp vgs lchtint=#0000ff stat
{-0.000000,131.208094,301.364692}
ColorPalette=#0000a9;...

As a consequence, one needs to manipulate (shift and stretch) the L channel values more after lchtint, for example by using litadd and litmul commands:

  • palcomp vgs lchtint=#0000ff litadd=-42 litmul=1.74 lch xfce
  • palcomp vgs lchtint=#0080ff litadd=-25 litmul=1.49 lch xfce

Stretching the brightness this way has the side-effect that all colors get a bit darker, which may be undesirable. Instead of combining a tint with litadd and litmul, I can recommend to force color 0 to black using the b0 command. ๐Ÿ–ค

๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

hxtools(7) โ€” the whole hxtools family is right there, bestie. Go browse. ๐Ÿซถ


๐Ÿซถ Cute little sign-off: this is source/version hxtools, dated 2022-10-23, and itโ€™s the palcomp(1) manual page signing off. Bye bestie, go make your terminal palette iconic ๐Ÿ’–โœจ
๐Ÿ“ฆ where this page comes from