Skip to content

Commit

Permalink
Improve foot configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
serverwentdown committed Feb 15, 2024
1 parent d9a6fd7 commit d93d603
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 10 deletions.
40 changes: 40 additions & 0 deletions .config/foot/foot.dark.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
font=Fira Code:size=11
font-bold=Fira Code:weight=bold:size=11
font-italic=IBM Plex Mono:slant=italic:size=11
font-bold-italic=IBM Plex Mono:weight=bold:slant=italic:size=11
line-height=18
vertical-letter-offset=2
dpi-aware=no
pad=20x20
resize-delay-ms=500

[tweak]
#render-timer=osd

[colors]
alpha=0.875
#cursor_text_color=073642
#cursor=839496
foreground=839496
background=002b36
#selection_foreground=93a1a1
#selection_background=073642
regular0=073642
regular1=dc322f
regular2=859900
regular3=b58900
regular4=268bd2
regular5=d33682
regular6=2aa198
regular7=eee8d5
bright0=002b36
bright1=cb4b16
bright2=586e75
bright3=657b83
bright4=839496
bright5=6c71c4
bright6=93a1a1
bright7=fdf6e3

[csd]
border-width=8
138 changes: 138 additions & 0 deletions .config/foot/foot.generate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#!/usr/bin/env python

import sys
import re


COLORSCHEMES = {
"dark": {
"theme": "solarized",
"palette": "solarized",
"cursor_text_color": "{base02}",
"cursor": "{base0}",
"foreground": "{base0}",
"background": "{base03}",
"selection_foreground": "{base1}",
"selection_background": "{base02}",
},
"light": {
"theme": "solarized",
"palette": "solarized",
"cursor_text_color": "{base2}",
"cursor": "{base00}",
"foreground": "{base00}",
"background": "{base3}",
"selection_foreground": "{base01}",
"selection_background": "{base2}",
},
"greyscale-dark": {
"theme": "solarized",
"palette": "solarized-greyscale",
"cursor_text_color": "{base02}",
"cursor": "{base0}",
"foreground": "{base0}",
"background": "{base03}",
"selection_foreground": "{base1}",
"selection_background": "{base02}",
},
"greyscale-light": {
"theme": "solarized",
"palette": "solarized-greyscale",
"cursor_text_color": "{base2}",
"cursor": "{base00}",
"foreground": "{base00}",
"background": "{base3}",
"selection_foreground": "{base01}",
"selection_background": "{base2}",
},
}

THEMES = {
"solarized": {
"color0": "{base02}",
"color1": "{red}",
"color2": "{green}",
"color3": "{yellow}",
"color4": "{blue}",
"color5": "{magenta}",
"color6": "{cyan}",
"color7": "{base2}",
"color8": "{base03}",
"color9": "{orange}",
"color10": "{base01}",
"color11": "{base00}",
"color12": "{base0}",
"color13": "{violet}",
"color14": "{base1}",
"color15": "{base3}",
},
}

TABLE_HEADER = """
" SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB
" --------- ------- ---- ------- ----------- ---------- ----------- -----------
""".strip().split(
"\n"
)


def read_table(f):
match_window = []
# Read until we find the table header
for line in f:
line = line.strip()
match_window.append(line)
if len(match_window) <= len(TABLE_HEADER):
continue
match_window.pop(0)
if match_window == TABLE_HEADER:
break
# Read table
for line in f:
parts = [p for p in re.split("[ \"']+", line) if len(p) > 0]
if len(parts) < 3:
break
yield (parts[0], parts[1])


def read_palette(filename):
palette = {}
with open(filename, "r") as f:
for name, value in read_table(f):
palette[name] = value
return palette


PALETTES = {
"solarized": read_palette("../nvim/colors/solarized.vim"),
"solarized-greyscale": {
**read_palette("../nvim/colors/solarized.vim"),
**{
"base03": "#202020",
"base02": "#2d2d2d",
"base01": "#606060",
"base00": "#6d6d6d",
"base0": "#969696",
"base1": "#a0a0a0",
"base2": "#eaeaea",
"base3": "#f9f9f9",
},
},
}


for name, scheme in COLORSCHEMES.items():
theme = THEMES[scheme["theme"]]
palette = PALETTES[scheme["palette"]]

values = {}
for key, value in scheme.items():
values[key] = value.format(**palette).replace("#", "")
for key, value in theme.items():
values[key] = value.format(**palette).replace("#", "")

tmpl: str
with open("foot.ini.tmpl", "r") as f:
tmpl = f.read()
with open(f"foot.{name}.ini", "w") as f:
f.write(tmpl.format(**values))
40 changes: 40 additions & 0 deletions .config/foot/foot.greyscale-dark.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
font=Fira Code:size=11
font-bold=Fira Code:weight=bold:size=11
font-italic=IBM Plex Mono:slant=italic:size=11
font-bold-italic=IBM Plex Mono:weight=bold:slant=italic:size=11
line-height=18
vertical-letter-offset=2
dpi-aware=no
pad=20x20
resize-delay-ms=500

[tweak]
#render-timer=osd

[colors]
alpha=0.875
#cursor_text_color=2d2d2d
#cursor=969696
foreground=969696
background=202020
#selection_foreground=a0a0a0
#selection_background=2d2d2d
regular0=2d2d2d
regular1=dc322f
regular2=859900
regular3=b58900
regular4=268bd2
regular5=d33682
regular6=2aa198
regular7=eaeaea
bright0=202020
bright1=cb4b16
bright2=606060
bright3=6d6d6d
bright4=969696
bright5=6c71c4
bright6=a0a0a0
bright7=f9f9f9

[csd]
border-width=8
File renamed without changes.
40 changes: 40 additions & 0 deletions .config/foot/foot.ini.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
font=Fira Code:size=11
font-bold=Fira Code:weight=bold:size=11
font-italic=IBM Plex Mono:slant=italic:size=11
font-bold-italic=IBM Plex Mono:weight=bold:slant=italic:size=11
line-height=18
vertical-letter-offset=2
dpi-aware=no
pad=20x20
resize-delay-ms=500

[tweak]
#render-timer=osd

[colors]
alpha=0.875
#cursor_text_color={cursor_text_color}
#cursor={cursor}
foreground={foreground}
background={background}
#selection_foreground={selection_foreground}
#selection_background={selection_background}
regular0={color0}
regular1={color1}
regular2={color2}
regular3={color3}
regular4={color4}
regular5={color5}
regular6={color6}
regular7={color7}
bright0={color8}
bright1={color9}
bright2={color10}
bright3={color11}
bright4={color12}
bright5={color13}
bright6={color14}
bright7={color15}

[csd]
border-width=8
40 changes: 40 additions & 0 deletions .config/foot/foot.light.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
font=Fira Code:size=11
font-bold=Fira Code:weight=bold:size=11
font-italic=IBM Plex Mono:slant=italic:size=11
font-bold-italic=IBM Plex Mono:weight=bold:slant=italic:size=11
line-height=18
vertical-letter-offset=2
dpi-aware=no
pad=20x20
resize-delay-ms=500

[tweak]
#render-timer=osd

[colors]
alpha=0.875
#cursor_text_color=eee8d5
#cursor=657b83
foreground=657b83
background=fdf6e3
#selection_foreground=586e75
#selection_background=eee8d5
regular0=073642
regular1=dc322f
regular2=859900
regular3=b58900
regular4=268bd2
regular5=d33682
regular6=2aa198
regular7=eee8d5
bright0=002b36
bright1=cb4b16
bright2=586e75
bright3=657b83
bright4=839496
bright5=6c71c4
bright6=93a1a1
bright7=fdf6e3

[csd]
border-width=8
3 changes: 3 additions & 0 deletions .config/sway/config
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ bindsym $mod+F10 input * xkb_switch_layout 1, input * xkb_options "lv3:menu_swit

input type:touchpad {
natural_scroll enabled
scroll_method two_finger
click_method clickfinger
pointer_accel 0.15
}
input type:pointer {
natural_scroll enabled
Expand Down
2 changes: 1 addition & 1 deletion .config/sway/framework
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Output configuration:
#
set $output_laptop "Unknown 0x095F 0x00000000"
set $output_laptop "BOE 0x095F Unknown"
output $output_laptop position 0 0 transform 0 scale 1.25
bindsym $mod+XF86MonBrightnessDown output $output_laptop scale 1.25
bindsym $mod+XF86MonBrightnessUp output $output_laptop scale 1.5
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
!.config/containers
!.config/fontconfig
!.config/foot
.config/foot/foot.ini
!.config/git
!.config/kitty
.config/kitty/colorscheme.conf
Expand Down
22 changes: 13 additions & 9 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -567,19 +567,19 @@ slowest_functions+=( setup_nope )
# helper scripts

function theme {
local iterm_profile kitty_theme kitty_variation gnome_theme macos_theme
local iterm_profile term_theme term_variation gnome_theme macos_theme
case "$2" in
g)
kitty_variation=greyscale-
term_variation=greyscale-
;;
*)
kitty_variation=
term_variation=
;;
esac
case "$1" in
light)
iterm_profile=Light
kitty_theme=${kitty_variation}light
term_theme=${term_variation}light
export LIGHT=true
echo "export LIGHT=true" > ~/.zshrc-theme
gnome_theme=Adwaita
Expand All @@ -588,7 +588,7 @@ function theme {
;;
dark)
iterm_profile=Default
kitty_theme=${kitty_variation}dark
term_theme=${term_variation}dark
export LIGHT=false
echo "export LIGHT=false" > ~/.zshrc-theme
gnome_theme=Adwaita-dark
Expand All @@ -600,11 +600,15 @@ function theme {
echo -e "\033]50;SetProfile=$ITERM_PROFILE\a"
fi
if [[ "$TERM" == "xterm-kitty" ]]; then
kitty @ set-colors -c -a ~/.config/kitty/colorscheme.$kitty_theme.conf
kitty @ set-colors -c -a ~/.config/kitty/colorscheme.$term_theme.conf
kitty @ env LIGHT=$LIGHT
if [[ -z "$SSH_CLIENT" ]]; then
ln -sf colorscheme.$kitty_theme.conf ~/.config/kitty/colorscheme.conf
fi
fi
if [[ "$TERM" == "foot-extra" ]]; then

fi
if [[ -z "$SSH_CLIENT" ]]; then
ln -sf foot.$term_theme.ini ~/.config/foot/foot.ini
ln -sf colorscheme.$term_theme.conf ~/.config/kitty/colorscheme.conf
fi
setup_prompt
if [[ -z "$SSH_CLIENT" ]]; then
Expand Down

0 comments on commit d93d603

Please sign in to comment.