Skip to content
standard graphics - "let's make 2D graphics simple and accessible to everyone"
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs updated gitignore Jul 2, 2019
playground implemented handle forever command Jul 3, 2019
.gitignore updated gitignore Jul 2, 2019
Cargo.lock added support for changing title and dimensions Jul 3, 2019
Cargo.toml added support for outlined shapes and circles Jul 2, 2019
LICENSE removed example Jul 7, 2019
SDL2.lib added SDL2.lib to repository Jul 2, 2019

Standard Graphics

Standard Graphics is a universal rendering engine abstraction for 2D graphics. It provides a cross-platform, language-agnostic interface based on the stdin and stdout streams available on most operating systems. This allows you or your team to change developer environments (operating system, languages, stack, etc.) without having to change platform support (operating systems, hardware, back-end, etc.) and to change platform support without having to change developer environment. Standard Graphics is implemented in Rust with a binding to SDL2 and compiles to a safe, efficient binary with help from LLVM.


Standard Graphics currently provides a small but growing set of commands to print graphics and handle events.

  • Draw lines, points
  • Draw circles, squares, rectangles
  • Draw with fill or outline
  • Handle mouse events, touch events

This allows Standard Graphics to be used to create simple data visualizations, visual simulations, animations, etc.


Here is an example of stdg being used by a Ruby program-

puts 'window 400 400'
puts 'title Untitled'

loop do
	puts 'color 255 255 255'
	puts 'clear'
	puts 'color 255 0 0'
	puts 'rect 50 50 100 100'
	puts 'present'
	puts 'handle'

The graphics for this program can be rendered by piping the program's output to stdg instead of stdout.

ruby draw_rectangle.rb | stdg

This will open the following window to output the graphics.

An example output through standard graphics

Here's another example. This example is taken from Khan Academy's "Making animations" lesson. Since this program is written in Python, you will have to use the Python interpreter to run it.

print("window 400 400")
print("title Untitled")

# position of the car
x = 10

while True:
	print("color 151 244 247")

	# draw the car body
	print("color 255 0 115")
	print("fill rect " + str(x) + " 200 100 20")
	print("fill rect " + str(x + 15) + " 178 70 40")

	# draw the wheels
	print("color 77 66 66")
	print("fill circle " + str(x + 25) + " 221 12")
	print("fill circle " + str(x + 75) + " 221 12")


	x = x + 1
python | stdg

An example output through standard graphics


The easiest way to install Standard Graphics is by downloading and installing the binaries from here.

You can also install Standard Graphics by building from source.

$ curl -sSf | sh
$ git clone
$ cd stdg
$ cargo install --path .
You can’t perform that action at this time.