Skip to content

Instantly share code, notes, and snippets.

@ricardobeat
Last active January 20, 2026 15:48
Show Gist options
  • Select an option

  • Save ricardobeat/b9fd52ea6502bb813d6a7ed394f41cd7 to your computer and use it in GitHub Desktop.

Select an option

Save ricardobeat/b9fd52ea6502bb813d6a7ed394f41cd7 to your computer and use it in GitHub Desktop.
GhosTTY config
background = 020503
foreground = ffffff
theme = "Blue Matrix"
#background-blur-radius = 4
#background-opacity = 0.86
window-padding-x = 20
window-padding-y = 34
macos-titlebar-style = tabs
macos-window-shadow = false
macos-non-native-fullscreen = true
shell-integration-features = cursor,title
custom-shader = ~/.config/ghostty/shaders/crt.glsl
custom-shader = ~/.config/ghostty/shaders/bloom.glsl
minimum-contrast = 8
macos-icon = custom-style
macos-icon-ghost-color = BCBEC4
macos-icon-screen-color = 1E1F22
cursor-style = block
window-inherit-working-directory = false
/*
Bloom pass
"GM Shaders: CRT" by @XorDev
How to create a simple CRT effect including:
-RGB pixel cells
-Chromatic aberration
-Screen curvature
-Vignette
-Pulsing
-Bloom pass
Based on my 1 pass blur:
https://github.com/XorDev/1PassBlur
*/
//Bloom radius in pixels
#define BLOOM_RADIUS 12.0
//Bloom texture samples
#define BLOOM_SAMPLES 32.0
//Bloom base brightness
#define BLOOM_BASE 0.97
//Bloom glow brightness
#define BLOOM_GLOW 2.4
//don't really know what I'm doing but this stops it from blowing out whites
#define TONE_DOWN 0.6
void mainImage( out vec4 fragColor, in vec2 fragCoord)
{
//Resolution and texel size
vec2 res = iResolution.xy;
vec2 texel = 1.0 / res;
//Bloom total
vec4 bloom = vec4(0);
//Sample point
vec2 point = vec2(BLOOM_RADIUS, 0)*inversesqrt(BLOOM_SAMPLES);
for(float i = 0.0; i<BLOOM_SAMPLES; i++)
{
//Rotate by golden angle
point *= -mat2(0.7374, 0.6755, -0.6755, 0.7374);
//Compute sample coordinates from rotated sample point
vec2 coord = (fragCoord + point*sqrt(i)) * texel;
//Add bloom samples
bloom += texture(iChannel0, coord) * (1.0 - i/BLOOM_SAMPLES);
}
//Compute bloom average
bloom *= BLOOM_GLOW/BLOOM_SAMPLES * TONE_DOWN;
//Add base sample
bloom += texture(iChannel0,fragCoord*texel)*BLOOM_BASE;
fragColor = bloom;
}
/*
CRT pass
*/
//RGB Mask intensity(0 to 1)
#define MASK_INTENSITY 0.1
//Mask size (in pixels)
#define MASK_SIZE 0.1
//Border intensity (0 to 1)
#define MASK_BORDER 0.4
//Chromatic abberration offset in texels (0 = no aberration)
#define ABERRATION_OFFSET vec2(0.5,0)
//Curvature intensity
#define SCREEN_CURVATURE 0.019
//Screen vignette
#define SCREEN_VIGNETTE 0.24
#define BRIGHTNESS_BOOST 1
//Intensity of pulsing animation
#define PULSE_INTENSITY 0.012
//Pulse width in pixels (times tau)
#define PULSE_WIDTH 130
//Pulse animation speed
#define PULSE_RATE 30
void mainImage( out vec4 fragColor, in vec2 fragCoord)
{
//Resolution
vec2 res = iResolution.xy;
//Signed uv coordinates (ranging from -1 to +1)
vec2 uv = fragCoord/res * 2.0 - 1.0;
//Scale inward using the square of the distance
float curve = iResolution.x / 2600 * 0.01;
uv *= 1.0 + (dot(uv,uv) - 1.0) * curve;
//Convert back to pixel coordinates
vec2 pixel = (uv*0.5+0.5)*res;
//Square distance to the edge
vec2 edge = max(1.0 - uv*uv, 0.0);
//Compute vignette from x/y edges
float vignette = pow(edge.x * edge.y, SCREEN_VIGNETTE);
//RGB cell and subcell coordinates
vec2 coord = pixel / MASK_SIZE;
vec2 subcoord = coord * vec2(2,1);
//Offset for staggering every other cell
vec2 cell_offset = vec2(0, fract(floor(coord.x)*0.5));
//Pixel coordinates rounded to the nearest cell
vec2 mask_coord = floor(coord+cell_offset) * MASK_SIZE;
//Chromatic aberration
vec4 aberration = texture(iChannel0, (mask_coord-ABERRATION_OFFSET) / res);
//Color shift the green channel
aberration.g = texture(iChannel0, (mask_coord+ABERRATION_OFFSET) / res).g;
//Output color with chromatic aberration
vec4 color = aberration;
//Compute the RGB color index from 0 to 2
float ind = mod(floor(subcoord.x), 3.0);
//Convert that value to an RGB color (multiplied to maintain brightness)
vec3 mask_color = vec3(ind == 0.0, ind == 1.0, ind == 2.0) * 3.0;
//Signed subcell uvs (ranging from -1 to +1)
vec2 cell_uv = fract(subcoord + cell_offset) * 2.0 - 1.0;
//X and y borders
vec2 border = 1.0 - cell_uv * cell_uv * MASK_BORDER;
//Blend x and y mask borders
mask_color.rgb *= border.x * border.y;
//Blend with color mask
color.rgb *= 1.0 + (mask_color - 1.0) * MASK_INTENSITY;
//Apply vignette
color.rgb *= vignette * BRIGHTNESS_BOOST;
//Apply pulsing glow
color.rgb *= 1.0+PULSE_INTENSITY*cos(pixel.x/PULSE_WIDTH+iTime*PULSE_RATE);
fragColor = color;
}
@ricardobeat
Copy link
Author

ricardobeat commented Jan 7, 2026

mkdir -p ~/.config/ghostty/shaders/
GIST_URL=https://raw.github.com/gist/ricardobeat/b9fd52ea6502bb813d6a7ed394f41cd7
curl -L $GIST_URL/raw/ghostty.ini -o ~/Library/Application\ Support/com.mitchellh.ghostty/config
curl -L $GIST_URL/raw/shaders_bloom.glsl -o ~/.config/ghostty/shaders/bloom.glsl
curl -L $GIST_URL/raw/shaders_crt.glsl -o ~/.config/ghostty/shaders/crt.glsl

@ricardobeat
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment