Skip to content

Instantly share code, notes, and snippets.

@ajstarks
Created July 5, 2014 08:48
Show Gist options
  • Save ajstarks/3b52b574a3542bced08e to your computer and use it in GitHub Desktop.
Save ajstarks/3b52b574a3542bced08e to your computer and use it in GitHub Desktop.
Slide generation example
package main
import (
"os"
"github.com/ajstarks/deck/generate"
)
func main() {
deck := generate.NewSlides(os.Stdout, 0, 0)
deck.StartDeck() // start the deck
// Text alignment
deck.StartSlide("rgb(180,180,180)") // New slide with a gray background
deck.Text(50, 80, "left", 10, "black") // left-aligned black text
deck.TextMid(50, 50, "center", 10, "gray") // centered gray text
deck.TextEnd(50, 20, "right", 10, "white") // right-aligned white text
deck.Line(50, 100, 50, 0, 0.2, "black", 20) // vertical line
deck.EndSlide() // end the slide
// List
items := []string{"First", "Second", "Third", "Fourth", "Fifth"}
deck.StartSlide() // start a new slide
deck.Text(10, 90, "Imporant Items", 5, "") // title for the list
deck.List(10, 80, 4, items, "bullet", "red") // make a bullet list
deck.EndSlide() // end the slide
deck.EndDeck() // end the deck
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment