Skip to content

fourzerosix/cool-s

Repository files navigation

cool-s

The most universally drawn doodle in human history. Now in your terminal.

cool-s draws the legendary Cool S stroke by stroke - in glorious ANSI color - right in your terminal. Like sl but gnarlier/cooler/fresher and certainly more dope.

          /\
        //  \\
      //      \\
    //          \\
  //      ||      \\
  ||      ||      ||
  ||      ||      ||
  ||      ||      ||
  \\      \\      ||
    \\      \\   /
      \\      //
    /    \\      //
  ||      \\      //
  ||      ||      ||
  ||      ||      ||
  ||      ||      ||
  \\      ||      //
    \\          //
      \\      //
        \\  //
          //

Install in 30 seconds

Just like the blue-box macaroni we were all fed that's probably still clogging our arteries. . .

From source (Linux / macOS / WSL):

git clone https://github.com/fourzerosix/cool-s.git
cd cool-s
make
sudo make install

Via pip (Python wrapper):

pip install cool-s
cool-s

Via Docker:

docker run --rm -it YOUR_DOCKERHUB_USERNAME/cool-s

Usage

cool-s [OPTIONS]

  -f                 Fast mode - instant render/no animation
  -d USECS           Per-pixel delay in microseconds (default: 40000)
  -s SCALE           Scale factor 1-8 (default: 3, auto-fits your terminal)
  -r                 Rainbow finale (be yourself - be proud)
  -o, --oppenheimer  Detonate the S at the end - "Now I am become death, the destroyer of S's."
  --no-sparks        Disable spark particles (we should have also probably disabled the drink in the early 2000's) 
  --plain            No color output (you'll enjoy plain or choose your own switch from the willow tree)
  -h, --help         Show help and exit (in the 90s nobody really cared if you screamed "HELP" - but we do)
cool-s                    # The full animated experience
cool-s -f -s 5            # Instant - large (MURRRICA MODE)
cool-s -o                 # Now I am become S
cool-s -d 60000 -r        # Slow-draw with rainbow finale (like Clint Eastwood but with love)
cool-s -s 2 --plain       # Small - monochrome - great for pipes (HEY! it's not *that* small)

The Lore (a 90s kid's deep-dive)

If you grew up in the 80s or 90s, you know the S. You didn't learn it in class. You didn't read it in a book. Some kid - maybe on the bus, maybe at lunch, maybe during a math test you were definitely failing - leaned over and showed you six lines, then connected them. Then added a pointy top and a pointy bottom. Suddenly, you had the coolest thing your pen had ever made.

You covered your Trapper Keeper in them. Your desk. The margins of your Lisa Frank notebook. The back of your hand. Time itself had no meaning while the S was being drawn.

But where did it come from? Nobody knew. Nobody knows. That's kind of the thing.

What even is it?

The Cool S - also known as the Universal S, the Super S, the Pointy S, and the Graffiti S - is a graffiti sign in popular culture and childlore, typically doodled on children's notebooks or graffitied on walls. It consists of exactly 14 line segments forming a stylized, pointed S-shape. It has also been compared to the infinity symbol - the S appears to have depth, where the overlap in the center and the appearance of a potential altitude change at the top and bottom make it look like it connects back to itself, whilst making the world wround you connect in a sort of ethereal way (as you listen the the self-titled Sublime album - love is, it's what we've got - remember that).

Mathematically speaking, the Cool S has no reflection symmetry but has 2-fold rotational symmetry. Spin it 180 degrees and it looks identical (which is deeply satisfying and also completely useless information that you will now think about every time you draw one)

The construction (the sacred recipe)

This is the part that made it viral before "viral" was a word:

  1. Draw three short vertical bars - evenly spaced (or it's detention)
  2. Draw three more identical bars directly below - with a matching gap (a gap bigger than your momma's)
  3. Connect them with two diagonal lines - crossing left to right (Allen Iverson style, breakin' ankles)
  4. Cap the top with an inverted V (for all the haters)
  5. Cap the bottom with a V (for Vendetta)
  6. Add two short closing strokes at the middle junctions (cuz' who don't love closing strokes?)

That's it. That's the whole secret. Once you knew it, you couldn't stop. A professor of language and media at Middlesex University put it well when interviewed by VICE:

"It's probably a Moebius strip - it can't be drawn continuously, but it does have a perpetual flow. Most nine-year-olds can't draw, so when someone hands them a magical recipe to create something fairly cool on demand, that'll go viral."

The origin (nobody knows, but let's investigate anyway)

The exact origin of the Cool S is unknown, but it became prevalent around the early 1980s as a part of graffiti culture. Some people report seeing it as early as the 1960s. Similar designs for the S have also been identified as early as 1890. One art history professor suggested it may have originated as a "decorated initial" in medieval scripts. So qiute possibly the Cool S may have been invented by medieval monks (NOW, that's what i call RAD).

Jon Naar's photographs of graffiti in New York City, taken in 1973 and published in The Faith of Graffiti in 1974, frequently contain the symbol. Jean-Michel Basquiat - one of the most influential artists of the 20th century - occasionally featured it in his artworks, including Charles the First, and in Untitled (Olive Oyl) it is labelled "CLASSIC S OF GRAFF."

The childlore angle (this is actually kind of beautiful in a hiding under the mattress while the belt slaps the floor way)

The most compelling explanation isn't really an explanation at all - it's a classification. The Cool S is generally considered to be an artifact of childlore, meaning that it is taught by children to children over the course of generations. It spreads the same way jump-rope rhymes spread (just how your mom's legs spread 9 months before your ugly ass popped out). The same way that thing where you hold someone's wrists and spin them spread. Kid sees it, kid learns it, kid teaches it, repeat.

A 2022 Atlantic article on childlore noted that kids have been passing down games, rhymes, and legends this way since forever - and that the Cool S is one of the purest modern examples of the form. No adult invented it (no such thing as adults). No corporation owns it (well...). No one put it in a textbook. It just exists, flowing from kid to kid like a slightly more geometric version of cooties or alcoholism.

The terminal dimension

This is where cool-s enters the picture. The S has been drawn on notebooks, walls, desks, arms, textbook covers, bathroom stalls, and the margins of history exams. It has been photographed by documentary photographers in 1973, painted by Basquiat, worn on streetwear, and apparently trademarked by a former coffee van entrepreneur.

It had never been drawn, stroke by stroke, in 7-stage animated ANSI color with optional spark particles and an atomic bomb finale, in a Linux terminal.

Until now.


How it works

The geometry

The Cool S is 14 line segments across 7 stages:

Stage What is drawn Color
1 Three top vertical bars White
2 Three bottom vertical bars White
3 Two diagonal connectors Cyan
4 Top inverted-V cap Yellow
5 Bottom V base Green
6 Left closing diagonal Magenta
7 Right closing diagonal Red

All segments are defined in a square-pixel coordinate grid (x: 0-4, y: 0-10). At render time, each unit is multiplied by scale, and the x-coordinate is doubled (col = sq_x * scale * 2) to compensate for terminal character aspect ratio - giving true 45-degree diagonals that actually look like 45 degrees.

The animation

Each segment is drawn pixel by pixel using Bresenham's line algorithm. Between segments, spark particles emit from the endpoint and drift upward. After all 14 strokes, the shape flashes to solid white. With -r, it then cycles through all 7 stage colors in a rolling rainbow wave before settling.

The Oppenheimer mode (-o)

After the S finishes drawing, there is a brief pause. Then:

  1. Flash -- rapid white strobe fills the entire screen
  2. Shockwave -- an expanding ring pulses outward from center
  3. Debris -- every lit pixel becomes a particle flying away from center with velocity and gravity
  4. Fallout -- particles drift down and fade to ash

"Now I am become death, the destroyer of S's." -- J. Robert Oppenheimer (paraphrased; he was talking about a different kind of S)


Installation

From source

git clone https://github.com/fourzerosix/cool-s.git
cd cool-s
make
sudo make install          # installs to /usr/local/bin
sudo make uninstall        # removes it

Custom prefix:

sudo make install PREFIX=/usr

One-liner (no make):

gcc -O2 -o cool-s src/cool-s.c -lm && sudo cp cool-s /usr/local/bin/

Via pip

pip install cool-s
cool-s          # runs the binary

The pip package bundles the compiled binary for Linux x86-64 and macOS. On other platforms it compiles from source at install time (requires gcc).

Via Docker

# Interactive (recommended -- needs a TTY for ANSI animation)
docker run --rm -it YOUR_DOCKERHUB_USERNAME/cool-s

# With flags
docker run --rm -it YOUR_DOCKERHUB_USERNAME/cool-s cool-s -o

# Fast mode (works without TTY)
docker run --rm YOUR_DOCKERHUB_USERNAME/cool-s cool-s -f --plain

Platform support

Platform Status
Linux (x86-64) Full support
macOS (Intel/Apple) Full support
WSL / Windows Terminal Full support
FreeBSD / other POSIX Should work
Windows (native cmd) No

Requires a VT100-compatible terminal with ANSI color support. Most modern terminals qualify. If your terminal was made after 1990, you're fine.


Development

make check      # smoke tests
make dist       # create release tarball

See CONTRIBUTING.md for guidelines.


Credits & further reading

About

Renders the Cool S using 14-segment geometry animated in 7 construction stages - in remembrance of a time and place before TikTok.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors