theme.sh

#!/bin/bash
SB=sketchybar
FONT="SF Pro"

TEXT=0xebffffff
TEXT2=0x9effffff
TEXT3=0x57ffffff
PILL=0x21ffffff
HOVER=0x12ffffff
# The media progress plate: white at low opacity, so it reads as glass and not as a hue.
PROGRESS=0x14ffffff
CLEAR=0x00ffffff
# The tint of the island glass and the popup track. The system draws the glass solid under Reduce Transparency
# and with a stronger edge under Increase Contrast.
BAR_COLOR=0xe61e2023
BAR_EDGE=0x1fffffff
# Apple's dark-mode system yellow and red, for readings under strain.
WARN=0xffffd60a
CRIT=0xffff453a

# Sizes change at once and the helper's springs move the island glass to them. Colors and icon scale fade.
COLOR_ANIM=(--animate tanh 10)

# Spring response in seconds, damping ratio 1: the glass settles without a bounce. The helper reads them.
# RESIZE moves an island when its content changes. EMERGE and RETRACT are for popups.
SPRING_RESIZE=0.25
SPRING_EMERGE=0.30
SPRING_RETRACT=0.22

# Layout. An item with an explicit width ignores its padding, so every gap below is a width.
# App icon artwork fills about 80% of its canvas: scale 0.64 draws 16 pt of visible icon.
ICON_SCALE=0.64
ICON_SCALE_START=0.32   # half of ICON_SCALE: a newly shown app icon grows from here
APP_SLOT=20      # 16 pt icon centered, so 2 pt on each side and 4 pt between icons
NUM_GAP=4        # number to first icon: 4 + 2 = 6 pt
PILL_END=6       # last icon to pill edge: 2 + 6 = 8 pt, the same as pill edge to number
MAX_APPS=4

# The bar is clear and holds three pills: half.left, island.media, and half.right. The *.start and *.end
# items supply the 4 pt inner padding. The brackets keep their bounds and draw nothing: the helper's GlassLayer
# draws the glass at those bounds.
ISLAND_RADIUS=12
BAR_NOTCH=(color=$CLEAR border_width=0)
PILL_STYLE=(background.color=$CLEAR background.border_width=0 background.corner_radius=$ISLAND_RADIUS background.height=30)

# A fixed cell for the volume label, so "100%" fits and the media island's fit stays stable. An explicit
# width ignores padding: "100%" in SF Pro Medium 13 measures 35.4 pt, plus the 8 pt label.padding_right.
VOLUME_LABEL_WIDTH=44
# The CPU and memory labels get fixed cells the same way, so a new sample never resizes the right island.
CPU_LABEL_WIDTH=41      # 35.4 pt plus the 5 pt label.padding_right
MEMORY_LABEL_WIDTH=44   # 35.4 pt plus the 8 pt label.padding_right

# The media island starts this far from the left island. It equals POPUP_GAP and MERGE_DISTANCE: the glass
# starts to pull shapes together at MERGE_DISTANCE, so rest gaps of that size sit just outside the pull.
ISLAND_GAP=8
MERGE_DISTANCE=8

# The media controls are fixed cells, so the fit stays stable. The widest glyph (backward.fill and forward.fill,
# SF Pro Medium 13) advances 19.1 pt.
MEDIA_CONTROL_WIDTH=28

# The progress plate sits PROGRESS_INSET inside the island, on every side. Its corners are concentric with
# the island's 12 pt corners, and shrink to half the width while the plate is narrower than two radii.
PROGRESS_INSET=2
PROGRESS_HEIGHT=26
PROGRESS_RADIUS=10

# Native popups draw on system glass (NSGlassEffectView). They grow out of their pill on SPRING_EMERGE and are
# drawn back in on SPRING_RETRACT. Each width is the widest fixed row in SF Pro Semibold 13 plus POPUP_PADDING * 2. Text of any length (track titles,
# device names, event titles) truncates, so a width only keeps the common case whole. Bash 3.2 has no associative
# arrays, so each kind has its own variable. Battery, workspace and mode share INFORMATION.
POPUP_RADIUS=12
POPUP_WIDTH_VOLUME=220      # "✓  Studio Display Speakers" 171
POPUP_WIDTH_CLOCK=252       # seven day columns of 31.4 hold the 22 pt today circle
POPUP_WIDTH_NETWORK=244     # "Thunderbolt Ethernet Slot 0" at the 22 pt indent, which 232 cut on the bar
POPUP_WIDTH_BLUETOOTH=300   # AirPods Max name, output control, and a visible scrollbar
POPUP_WIDTH_TAILSCALE=260   # "Allow Incoming Connections" checkbox 201
POPUP_WIDTH_MEDIA=280       # 128 pt seek slider between two 56 pt time labels
POPUP_WIDTH_SYSTEM=280      # memory legend at 11 pt, 240
POPUP_WIDTH_FRONT=240       # window titles are long; the app name needs 120
POPUP_WIDTH_INFORMATION=220 # "Visual Studio Code  3" 135
POPUP_GAP=8
POPUP_PADDING=16
POPUP_ROW=32
CALENDAR_TODAY_SIZE=22