diff --git a/README.md b/README.md index af0f65a..c1e6859 100644 --- a/README.md +++ b/README.md @@ -36,21 +36,10 @@ You can supply a JSON stylesheet with the `-s` flag: ## Example Output -![Gold Dark Style](https://github.com/charmbracelet/gold/raw/master/cmd/gold/styles/dark.png) +![Gold Dark Style](https://github.com/charmbracelet/gold/raw/master/styles/dark.png) -Check out the [Gold Style Gallery](https://github.com/charmbracelet/gold/blob/master/cmd/gold/styles/README.md)! +Check out the [Gold Style Gallery](https://github.com/charmbracelet/gold/blob/master/styles/README.md)! ## Colors Currently `gold` uses the [Aurora ANSI colors](https://godoc.org/github.com/logrusorgru/aurora#Index). - -## Development - -Style definitions located in `styles/` can be embedded into the binary by -running [statik](https://github.com/rakyll/statik): -``` -statik -f -src styles -include "*.json" -``` - -You can re-generate screenshots of all available styles by running `gallery.sh`. -This requires `termshot` and `pngcrush` installed on your system! diff --git a/gallery.sh b/gallery.sh deleted file mode 100755 index 1b84afc..0000000 --- a/gallery.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -for style in ./styles/*.json; do - echo "Generating screenshot for ${style}" - filename="`basename -s .json ${style}`.png" - - light="" - if [[ $style == *"light"* ]]; then - light="-l" - fi - - ./termshot ${light} -o ./styles/ -f "$filename" ./gold -s ${style} - pngcrush -ow "./styles/$filename" -done diff --git a/main.go b/main.go index 17de092..1c1fb7f 100644 --- a/main.go +++ b/main.go @@ -11,11 +11,9 @@ import ( "path/filepath" "github.com/mattn/go-isatty" - "github.com/rakyll/statik/fs" "github.com/spf13/cobra" "github.com/charmbracelet/gold" - _ "github.com/charmbracelet/gold/cmd/gold/statik" ) var ( @@ -92,27 +90,6 @@ func readerFromArg(s string) (*Source, error) { return &Source{r, u}, err } -func loadStyle(f string) ([]byte, error) { - var r io.ReadCloser - var err error - - r, err = os.Open(f) - if err != nil { - statikFS, err := fs.New() - if err != nil { - return nil, err - } - - r, err = statikFS.Open("/" + f + ".json") - if err != nil { - return nil, err - } - } - - defer r.Close() - return ioutil.ReadAll(r) -} - func execute(cmd *cobra.Command, args []string) error { var arg string if len(args) > 0 { @@ -127,12 +104,7 @@ func execute(cmd *cobra.Command, args []string) error { r := gold.NewPlainTermRenderer() if isatty.IsTerminal(os.Stdout.Fd()) { - json, err := loadStyle(style) - if err != nil { - return err - } - - r, err = gold.NewTermRendererFromBytes(json) + r, err = gold.NewTermRenderer(style) if err != nil { return err } diff --git a/statik/statik.go b/statik/statik.go deleted file mode 100644 index 057cef7..0000000 --- a/statik/statik.go +++ /dev/null @@ -1,12 +0,0 @@ -// Code generated by statik. DO NOT EDIT. - -package statik - -import ( - "github.com/rakyll/statik/fs" -) - -func init() { - data := "PK\x03\x04\x14\x00\x08\x00\x08\x00\xce\xba\x85O\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00 \x00dark.jsonUT\x05\x00\x015\x91\xe9]\x94\x92[N\xeb0\x10\x86\xdf\xb3\n\xcb\xe7\xe5 \x01j\xdd\x96KE\xd9\x08\xa0\xca\x89\xa7\xa9\x15_\xaa\x89-U\xa0J\xec\x81\x05 \xb1 \xf6\xc3\nX\x02\x8az\xb1CL(\x8f\xfe\xfd\xcf|s{\xca\x08\xa1\xc2\x16^\x83qtJ\x9a7!T\x1a\xb1}\x8fO\xb7B\xce\x8b\xaaD\xeb\x8d\x98\x17VY\xa4SB\xd9hLw\xdf+\x84\x85\\7\xe2\xbd\xd9k\xb5_\x04-#d\xd3\xe8TIS\x05\xce!\xd7\x90\x8d\xf6q\xde\x08@%\x0d\xd0)q\xe8\xa1\x83\xf8\xdf%\x9c\xb4\x01s\x07k\xd7O\xc9\xad\x12;\xc0!Tj^B\x7fX\xa8\xe2\xee\xf3\xf5\xe5\x9dtKy\xa0\xed|?\xd5r\x15|K\xe0B\x9a2\x98R\xe3\xd4\x1cKi\xa2\x95\x84\xf2&\xb4gK\x93\xcb\x084L3f\xb7\x89F\xc8\xcd\xac\xc3f\xdd\xe9\xf5\xa0/\xae#4K\xa3\xff\x91\xe0qH\x88\xd8\x02^\xdd\xdcb\xf3]\x9d\xbc\xa1(\xec [\xd08\xd1\xcf\xc3!\xd2\x9e\x8fI\x7f\x96\xd5\xe3\xb4\x9f\x8b\xe7\xf8Y{i2l\xabt\xd4e\xe2uA\xdc\x0513\xac\xb2`\xd7\x0d\xf4\x7f\xe0\x9c\xeb\xfe.u\xb4\xb0\x14\xef\x01O\xbd\xff\xceW\xe9-u\x86\xfdP\x8a\x8b\xd8\xcd\x89\xc1e\xdd\xde\x07\xb32\xc9oPRnw\x12\xfa\x95S\x95\x8bSK.\xd9\xe2\x18\xa4\x8b\xfcD\xe6Bx\xb0Z;\x92;\xd8\xd2\x8b\xb5\x13\xee\x97\x16>j\x0c\xab3\xd6\xebSr\xa5.\xdf\xe0\xfd\xf5\x0df\xfe&}\x1f\x01\x00\x00\xff\xffPK\x07\x08\xac\xc6\xad\xf0\xdf\x00\x00\x00|\x02\x00\x00PK\x01\x02\x14\x03\x14\x00\x08\x00\x08\x00\xce\xba\x85O\x9e\x12\xa9mU\x01\x00\x00n\x04\x00\x00 \x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x00\x00\x00\x00dark.jsonUT\x05\x00\x015\x91\xe9]PK\x01\x02\x14\x03\x14\x00\x08\x00\x08\x00\x13x\x82O\xac\xc6\xad\xf0\xdf\x00\x00\x00|\x02\x00\x00\n\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\xa4\x81\x95\x01\x00\x00light.jsonUT\x05\x00\x01\x16'\xe5]PK\x05\x06\x00\x00\x00\x00\x02\x00\x02\x00\x81\x00\x00\x00\xb5\x02\x00\x00\x00\x00" - fs.Register(data) -} diff --git a/styles/README.md b/styles/README.md deleted file mode 100644 index 97b746b..0000000 --- a/styles/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Gold Styles Gallery - -## Dark - -`gold -s dark` - -![Gold Dark Style](https://github.com/charmbracelet/gold/raw/master/cmd/gold/styles/dark.png) - -## Light - -`gold -s light` - -![Gold Light Style](https://github.com/charmbracelet/gold/raw/master/cmd/gold/styles/light.png) diff --git a/styles/dark.json b/styles/dark.json deleted file mode 100644 index 492d538..0000000 --- a/styles/dark.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "document": { - "indent": 4, - "background_color": "234", - "prefix": "\n", - "suffix": "\n" - }, - "link": { - "color": "123", - "underline": true, - "prefix": "(", - "suffix": ")" - }, - "link_text": { - "color": "123", - "bold": true - }, - "image": { - "color": "123", - "prefix": "[📷 ", - "suffix": "]" - }, - "image_text": { - "color": "8" - }, - "heading": { - "prefix": "\n", - "margin": 4, - "color": "15", - "background_color": "57" - }, - "h1": { - "prefix": "\n=> ", - "suffix": " <=", - "margin": 2, - "bold": true, - "background_color": "69" - }, - "h2": { - "prefix": "\n# " - }, - "table": { - "margin": 4 - }, - "paragraph": { - "margin": 4, - "color": "15", - "background_color": "235" - }, - "code": { - "color": "200" - }, - "code_block": { - "margin": 4, - "color": "200", - "theme": "solarized-dark" - }, - "emph": { - "italic": true - }, - "strong": { - "bold": true - }, - "list": { - "margin": 4, - "color": "15", - "background_color": "52" - }, - "item": { - "prefix": "• " - }, - "enumeration": { - "prefix": ". " - } -} diff --git a/styles/dark.png b/styles/dark.png deleted file mode 100644 index aee8706..0000000 Binary files a/styles/dark.png and /dev/null differ diff --git a/styles/light.json b/styles/light.json deleted file mode 100644 index 6b9d53d..0000000 --- a/styles/light.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "link": { - "color": "245", - "underline": true, - "prefix": "(", - "suffix": ")" - }, - "link_text": { - "color": "235", - "bold": true - }, - "image": { - "color": "245", - "prefix": "[Image: ", - "suffix": "]" - }, - "image_text": { - "color": "235" - }, - "heading": { - "bold": true, - "color": "1" - }, - "code": { - "color": "235" - }, - "code_block": { - "color": "235", - "theme": "solarized-light" - }, - "emph": { - "italic": true - }, - "strong": { - "bold": true - }, - "item": { - "prefix": "• " - } - } diff --git a/styles/light.png b/styles/light.png deleted file mode 100644 index 25a120e..0000000 Binary files a/styles/light.png and /dev/null differ