first commit

This commit is contained in:
Matt Anderson
2026-03-28 10:40:48 -05:00
commit 605c99bc01
36 changed files with 14317 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
# theme = onedark
theme = dark:onedark,light:onelight
# fonts
font-family = SFMono Nerd Font
# font-style = Regular
# font-style-bold = Regular
font-thicken = true
macos-titlebar-style = hidden
# linux
# gtk-titlebar = false
# cursor
shell-integration-features = no-cursor
cursor-style = block
# background
background-image = ~/.config/ghostty/earth.png
background-image-opacity = 0
background-image-fit = cover
macos-icon = xray
# shader
# custom-shader = ~/.config/ghostty/starfield.glsl

View File

@@ -0,0 +1,161 @@
float sdBox(in vec2 p, in vec2 xy, in vec2 b)
{
vec2 d = abs(p - xy) - b;
return length(max(d, 0.0)) + min(max(d.x, d.y), 0.0);
}
// //Author: https://iquilezles.org/articles/distfunctions2d/
float sdTrail(in vec2 p, in vec2 v0, in vec2 v1, in vec2 v2, in vec2 v3)
{
float d = dot(p - v0, p - v0);
float s = 1.0;
// Edge from v3 to v0
{
vec2 e = v3 - v0;
vec2 w = p - v0;
vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);
d = min(d, dot(b, b));
// Compute branchless boolean conditions:
float c0 = step(0.0, p.y - v0.y); // 1 if (p.y >= v0.y)
float c1 = 1.0 - step(0.0, p.y - v3.y); // 1 if (p.y < v3.y)
float c2 = 1.0 - step(0.0, e.x * w.y - e.y * w.x); // 1 if (e.x*w.y > e.y*w.x)
float allCond = c0 * c1 * c2;
float noneCond = (1.0 - c0) * (1.0 - c1) * (1.0 - c2);
// If either allCond or noneCond is 1, then flip factor becomes -1.
float flip = mix(1.0, -1.0, step(0.5, allCond + noneCond));
s *= flip;
}
// Edge from v0 to v1
{
vec2 e = v0 - v1;
vec2 w = p - v1;
vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);
d = min(d, dot(b, b));
float c0 = step(0.0, p.y - v1.y);
float c1 = 1.0 - step(0.0, p.y - v0.y);
float c2 = 1.0 - step(0.0, e.x * w.y - e.y * w.x);
float allCond = c0 * c1 * c2;
float noneCond = (1.0 - c0) * (1.0 - c1) * (1.0 - c2);
float flip = mix(1.0, -1.0, step(0.5, allCond + noneCond));
s *= flip;
}
// Edge from v1 to v2
{
vec2 e = v1 - v2;
vec2 w = p - v2;
vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);
d = min(d, dot(b, b));
float c0 = step(0.0, p.y - v2.y);
float c1 = 1.0 - step(0.0, p.y - v1.y);
float c2 = 1.0 - step(0.0, e.x * w.y - e.y * w.x);
float allCond = c0 * c1 * c2;
float noneCond = (1.0 - c0) * (1.0 - c1) * (1.0 - c2);
float flip = mix(1.0, -1.0, step(0.5, allCond + noneCond));
s *= flip;
}
// Edge from v2 to v3
{
vec2 e = v2 - v3;
vec2 w = p - v3;
vec2 b = w - e * clamp(dot(w, e) / dot(e, e), 0.0, 1.0);
d = min(d, dot(b, b));
float c0 = step(0.0, p.y - v3.y);
float c1 = 1.0 - step(0.0, p.y - v2.y);
float c2 = 1.0 - step(0.0, e.x * w.y - e.y * w.x);
float allCond = c0 * c1 * c2;
float noneCond = (1.0 - c0) * (1.0 - c1) * (1.0 - c2);
float flip = mix(1.0, -1.0, step(0.5, allCond + noneCond));
s *= flip;
}
return s * sqrt(d);
}
vec2 normalize(vec2 value, float isPosition) {
return (value * 2.0 - (iResolution.xy * isPosition)) / iResolution.y;
}
float ParametricBlend(float t)
{
float sqr = t * t;
return sqr / (2.0 * (sqr - t) + 1.0);
}
float antialising(float distance) {
return 1. - smoothstep(0., normalize(vec2(2., 2.), 0.).x, distance);
}
float determineStartVertexFactor(vec2 a, vec2 b) {
// Conditions using step
float condition1 = step(b.x, a.x) * step(a.y, b.y); // a.x < b.x && a.y > b.y
float condition2 = step(a.x, b.x) * step(b.y, a.y); // a.x > b.x && a.y < b.y
// If neither condition is met, return 1 (else case)
return 1.0 - max(condition1, condition2);
}
const vec4 TRAIL_COLOR = vec4(1.0, 0.725, 0.161, 1.0);
const vec4 TRAIL_COLOR_ACCENT = vec4(1.0, 0., 0., 1.0);
// const vec4 TRAIL_COLOR = vec4(0.482, 0.886, 1.0, 1.0);
// const vec4 TRAIL_COLOR_ACCENT = vec4(0.0, 0.424, 1.0, 1.0);
const vec4 CURRENT_CURSOR_COLOR = TRAIL_COLOR;
const vec4 PREVIOUS_CURSOR_COLOR = TRAIL_COLOR;
const float DURATION = 0.2;
void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
#if !defined(WEB)
fragColor = texture(iChannel0, fragCoord.xy / iResolution.xy);
#endif
//Normalization for fragCoord to a space of -1 to 1;
vec2 vu = normalize(fragCoord, 1.);
vec2 offsetFactor = vec2(-.5, 0.5);
//Normalization for cursor position and size;
//cursor xy has the postion in a space of -1 to 1;
//zw has the width and height
vec4 currentCursor = vec4(normalize(iCurrentCursor.xy, 1.), normalize(iCurrentCursor.zw, 0.));
vec4 previousCursor = vec4(normalize(iPreviousCursor.xy, 1.), normalize(iPreviousCursor.zw, 0.));
//When drawing a parellelogram between cursors for the trail i need to determine where to start at the top-left or top-right vertex of the cursor
float vertexFactor = determineStartVertexFactor(currentCursor.xy, previousCursor.xy);
float invertedVertexFactor = 1.0 - vertexFactor;
//Set every vertex of my parellogram
vec2 v0 = vec2(currentCursor.x + currentCursor.z * vertexFactor, currentCursor.y - currentCursor.w);
vec2 v1 = vec2(currentCursor.x + currentCursor.z * invertedVertexFactor, currentCursor.y);
vec2 v2 = vec2(previousCursor.x + currentCursor.z * invertedVertexFactor, previousCursor.y);
vec2 v3 = vec2(previousCursor.x + currentCursor.z * vertexFactor, previousCursor.y - previousCursor.w);
vec4 newColor = vec4(fragColor);
float progress = ParametricBlend(clamp((iTime - iTimeCursorChange) / DURATION, 0.0, 1.0));
//Distance between cursors determine the total length of the parallelogram;
float lineLength = distance(currentCursor.xy, previousCursor.xy);
float distanceToEnd = distance(vu.xy, vec2(currentCursor.x + (currentCursor.z / 2.), currentCursor.y - (currentCursor.w / 2.)));
float alphaModifier = distanceToEnd / (lineLength * (1.0 - progress));
// float d2 = sdTrail(vu, v0, v1, v2, v3);
// newColor = mix(newColor, TRAIL_COLOR_ACCENT, 1.0 - smoothstep(d2, -0.01, 0.001));
// newColor = mix(newColor, TRAIL_COLOR, 1.0 - smoothstep(d2, -0.01, 0.001));
// newColor = mix(newColor, TRAIL_COLOR, antialising(d2));
float cCursorDistance = sdBox(vu, currentCursor.xy - (currentCursor.zw * offsetFactor), currentCursor.zw * 0.5);
newColor = mix(newColor, TRAIL_COLOR_ACCENT, 1.0 - smoothstep(cCursorDistance, -0.000, 0.003 * (1. - progress)));
newColor = mix(newColor, CURRENT_CURSOR_COLOR, 1.0 - smoothstep(cCursorDistance, -0.000, 0.003 * (1. - progress)));
// float pCursorDistance = sdBox(vu, previousCursor.xy - (previousCursor.zw * offsetFactor), previousCursor.zw * 0.5);
// newColor = mix(newColor, PREVIOUS_CURSOR_COLOR, antialising(pCursorDistance));
fragColor = mix(fragColor, newColor, 1.);
// fragColor = mix(fragColor, newColor, 1.0 - alphaModifier);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 MiB

View File

@@ -0,0 +1,156 @@
// flip this: false = white stars on dark bg, true = dark stars on light bg
const bool invertStars = false;
// how dark the inverted stars are (0.0 = pure black, 1.0 = invisible/white)
const float invertedStarBrightness = 0.7;
// transparent background
const bool transparent = true;
// terminal contents luminance threshold to be considered background (0.0 to 1.0)
const float threshold = 0.15;
// divisions of grid
const float repeats = 6.;
// number of layers
const float layers = 3.;
float luminance(vec3 color) {
return dot(color, vec3(0.2126, 0.7152, 0.0722));
}
float N21(vec2 p) {
p = fract(p * vec2(233.34, 851.73));
p += dot(p, p + 23.45);
return fract(p.x * p.y);
}
vec2 N22(vec2 p) {
float n = N21(p);
return vec2(n, N21(p + n));
}
mat2 scale(vec2 _scale) {
return mat2(_scale.x, 0.0,
0.0, _scale.y);
}
// 2D Noise based on Morgan McGuire
float noise(in vec2 st) {
vec2 i = floor(st);
vec2 f = fract(st);
// Four corners in 2D of a tile
float a = N21(i);
float b = N21(i + vec2(1.0, 0.0));
float c = N21(i + vec2(0.0, 1.0));
float d = N21(i + vec2(1.0, 1.0));
// Smooth Interpolation
vec2 u = f * f * (3.0 - 2.0 * f); // Cubic Hermite Curve
// Mix 4 corners percentages
return mix(a, b, u.x) +
(c - a) * u.y * (1.0 - u.x) +
(d - b) * u.x * u.y;
}
float perlin2(vec2 uv, int octaves, float pscale) {
float col = 1.;
float initScale = 4.;
for (int l = 0; l < octaves; l++) {
float val = noise(uv * initScale);
if (col <= 0.01) {
col = 0.;
break;
}
val -= 0.01;
val *= 0.5;
col *= val;
initScale *= pscale;
}
return col;
}
vec3 stars(vec2 uv, float offset) {
float timeScale = -(iTime * 0.01 + offset) / layers;
float trans = fract(timeScale);
float newRnd = floor(timeScale);
vec3 col = vec3(0.);
// Translate uv then scale for center
uv -= vec2(0.5);
uv = scale(vec2(trans)) * uv;
uv += vec2(0.5);
// Create square aspect ratio
uv.x *= iResolution.x / iResolution.y;
// Create boxes
uv *= repeats;
// Get position
vec2 ipos = floor(uv);
// Return uv as 0 to 1
uv = fract(uv);
// Calculate random xy and size
vec2 rndXY = N22(newRnd + ipos * (offset + 1.)) * 0.9 + 0.05;
float rndSize = N21(ipos) * 200. + 500.;
vec2 j = (rndXY - uv) * rndSize;
float sparkle = 1. / dot(j, j);
col += vec3(1.0) * sparkle;
col *= smoothstep(1., 0.8, trans);
return col;
}
void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
// Normalized pixel coordinates (from 0 to 1)
vec2 uv = fragCoord / iResolution.xy;
vec3 col = vec3(0.);
for (float i = 0.; i < layers; i++) {
col += stars(uv, i);
}
// Clamp sparkle intensity
col = clamp(col, 0.0, 1.0);
// Invert: white sparkle on black bg becomes dark sparkle on white bg
if (invertStars) {
col = vec3(1.0) - col;
col = mix(col, vec3(1.0), invertedStarBrightness);
}
// Sample the terminal screen texture including alpha channel
vec4 terminalColor = texture(iChannel0, uv);
if (transparent) {
col = invertStars ? col * terminalColor.rgb : col + terminalColor.rgb;
}
// Mask: detect background pixels of terminal content
// For light bg, background has HIGH luminance; for dark bg, background has LOW luminance
float termLum = luminance(terminalColor.rgb);
float mask;
if (invertStars) {
// Light bg: background is bright, text is dark — show stars where luminance is HIGH
mask = step(1.0 - threshold, termLum);
} else {
// Dark bg: background is dark, text is bright — show stars where luminance is LOW
mask = 1.0 - step(threshold, termLum);
}
vec3 blendedColor = mix(terminalColor.rgb, col, mask);
// Apply terminal's alpha to control overall opacity
fragColor = vec4(blendedColor, terminalColor.a);
}

View File

@@ -0,0 +1,18 @@
palette = 0=#282c34
palette = 1=#e06c75
palette = 2=#98c379
palette = 3=#e5c07b
palette = 4=#61afef
palette = 5=#c678dd
palette = 6=#56b6c2
palette = 7=#abb2bf
palette = 8=#5f687b
palette = 9=#e06c75
palette = 10=#98c379
palette = 11=#e5c07b
palette = 12=#61afef
palette = 13=#c678dd
palette = 14=#56b6c2
palette = 15=#bfc5ce
background = #111111
foreground = #abb2bf

View File

@@ -0,0 +1,18 @@
palette = 0=#000000
palette = 1=#b6443a
palette = 2=#40803f
palette = 3=#795300
palette = 4=#3360c1
palette = 5=#841e83
palette = 6=#006996
palette = 7=#6d6d59
palette = 8=#000000
palette = 9=#b6443a
palette = 10=#40803f
palette = 11=#795300
palette = 12=#3360c1
palette = 13=#841e83
palette = 14=#006996
palette = 15=#ccccc0
background = #eeeeee
foreground = #2a2b33