Skip to content

A Go library that builds html pages styled similarly to the LCARS user interface from the 24th Century. The LCARS CSS template is based off of joernweissenborn's lcars css template

Notifications You must be signed in to change notification settings

picardrulez/lcars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lcars

A Go library that builds html pages styled similarly to the LCARS user interface from the 24th Century. The LCARS CSS template is based off of https://github.com/joernweissenborn/lcars

Example usage:

package main
import (
  "github.com/picardrulez/lcars"
  "net/http"
 )
 
 func main() {
  http.HandleFunc("/", exampleHandler)
  http.ListenAndServe(":8000", nil)
 }
 
func exampleHandler(w http.ResponseWriter, r *http.Request) {

  //Create a string array containing your menu items.  each aray item should contain the url followed by the link name delimited  by a pipe "|"
  mymenuitems := []string("/settings|settings", "/about|about", "/logout|logout")

  //Create an lcars.Menu struct containing your array of menu items
  mymenu := lcars.Menu{Items: mymenuitems}

  //create a variable containing a string of the html you want in the main area of the page
  content := `
    <h1> Here's a header</h1>
    and here's some text
   `

   //run the lcars.MakePage function including the content and menu struct as attributes
   t, createPage := lcars.MakePage(content, mymenu)

   //Execute the page
   t.Execute(w, createPage)

About

A Go library that builds html pages styled similarly to the LCARS user interface from the 24th Century. The LCARS CSS template is based off of joernweissenborn's lcars css template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages