initial commit

This commit is contained in:
Chris Ha 2022-04-03 21:45:35 -05:00
commit fb46b909c8
9 changed files with 242 additions and 0 deletions

16
.editorconfig Normal file
View file

@ -0,0 +1,16 @@
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[{go.mod,go.sum,*.go}]
indent_style = tab
indent_size = 4
[{Makefile,Dockerfile,*.yml,*.yaml}]
indent_style = tab
indent_size = 2

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
rose_pine
*.png

7
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,7 @@
{
"recommendations": [
"golang.go",
"editorconfig.editorconfig",
"aaron-bond.better-comments",
]
}

12
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,12 @@
{
"go.lintOnSave": "file",
"go.formatTool": "goimports",
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
"go.docsTool": "gogetdoc"
}

35
README.md Normal file
View file

@ -0,0 +1,35 @@
<p align="center">
<img src="https://github.com/rose-pine/rose-pine-theme/raw/main/assets/icon.png" width="80" />
<h2 align="center">Rosé Pine Wallpaper Generator</h2>
</p>
<p align="center">All natural pine, faux fur and a bit of soho vibes for the classy minimalist</p>
<p align="center">
<a href="https://github.com/rose-pine/rose-pine-theme">
<img src="https://img.shields.io/badge/community-rosé%20pine-26233a?labelColor=191724&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjUwIiBoZWlnaHQ9IjIzNyIgdmlld0JveD0iMCAwIDI1MCAyMzciIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xNjEuMjI3IDE2MS4yNTFDMTMyLjE1NCAxNjkuMDQxIDExNC45MDEgMTk4LjkyNCAxMjIuNjkxIDIyNy45OTdDMTIzLjkyNSAyMzIuNjAzIDEyOC42NTkgMjM1LjMzNiAxMz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LjIxODggMjcuNzc3OCAxMjQuMzY5IDI3Ljc3NzhDMTUwLjUxOCAyNy43Nzc4IDE3MS43MTcgNDguOTc2NCAxNzEuNzE3IDc1LjEyNjNaIiBmaWxsPSIjRUJCQ0JBIi8+CjxwYXRoIGQ9Ik0xNDQuMjE3IDg2LjIzNzlDMTYxLjY0OSA1Ni4wNDMyIDE1MS4zMDMgMTcuNDMyOSAxMjEuMTA4IDBMMTA2LjA2IDI2LjA2NDRDODguNjI3IDU2LjI1OSA5OC45NzM2IDk0Ljg2OTQgMTI5LjE2OCAxMTIuMzAyTDE0NC4yMTcgODYuMjM3OVoiIGZpbGw9IiNFQkJDQkEiLz4KPHBhdGggZD0iTTEyNS4yOTkgNjAuOTc4OUMxMTYuMjc1IDI3LjMwMTIgODEuNjU3NSA3LjMxNTY3IDQ3Ljk3OTcgMTYuMzM5Nkw2NC4zMTk3IDc3LjMyMTFDNzMuMzQzNiAxMTAuOTk5IDEwNy45NjEgMTMwLjk4NCAxNDEuNjM5IDEyMS45NkwxMjUuMjk5IDYwLjk3ODlaIiBmaWxsPSIjRUJCQ0JBIi8+CjxwYXRoIGQ9Ik0xMjQuOTI2IDYwLjk3ODlDMTMzLjk1IDI3LjMwMTIgMTY4LjU2NyA3LjMxNTY3IDIwMi4yNDUgMTYuMzM5NkwxODUuOTA1IDc3LjMyMTFDMTc2Ljg4MSAxMTAuOTk5IDE0Mi4yNjMgMTMwLjk4NCAxMDguNTg2IDEyMS45NkwxMjQuOTI2IDYwLjk3ODlaIiBmaWxsPSIjRUJCQ0JBIi8+Cjwvc3ZnPgo=&style=for-the-badge" />
</a>
</p>
## To generate all PNG files,
```bash
go run main.go
```
Or,
```bash
task build
chmod +x rose_pine
./rose_pine
```
requires **go-task**
## Credits
[generativeart](https://github.com/jdxyw/generativeart)
[rose pine theme](https://github.com/rose-pine)
[go-task](https://github.com/go-task/task)

11
Taskfile.yml Normal file
View file

@ -0,0 +1,11 @@
version: '3'
tasks:
build:
cmds:
- go build -o rose_pine
install:
cmds:
- task build
- cp rose_pine ~/bin/

11
go.mod Normal file
View file

@ -0,0 +1,11 @@
module go-rosepine-genart
go 1.18
require github.com/jdxyw/generativeart v0.0.0-20220127024657-50049f153090
require (
github.com/fogleman/gg v1.3.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect
)

19
go.sum Normal file
View file

@ -0,0 +1,19 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/jdxyw/generativeart v0.0.0-20220127024657-50049f153090 h1:p3I1AdXWM+Uqw53I+VyGMGEoN2JxHWAVq3TRE0ekZcQ=
github.com/jdxyw/generativeart v0.0.0-20220127024657-50049f153090/go.mod h1:KLeb41mWAuL1YMqEuhikZ6/kC/yZJyvda4ZUaVzpu6A=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/RSWWQlWv34418dnEixWk=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

129
main.go Normal file
View file

@ -0,0 +1,129 @@
package main
import (
"fmt"
"image/color"
"math/rand"
"sync"
"time"
"github.com/jdxyw/generativeart"
"github.com/jdxyw/generativeart/arts"
)
const CANVAS_WIDTH = 3456
const CANVAS_HEIGHT = 2234
var ROSE_PINE_BASE = color.RGBA{25, 23, 36, 255}
var ROSE_PINE_COLORS = []color.RGBA{
{0xEB, 0x6F, 0x92, 0xFF},
{0xF6, 0xC1, 0x77, 0xFF},
{0xEB, 0xBC, 0xBA, 0xFF},
{0x31, 0x74, 0x8F, 0xFF},
{0x9C, 0xCF, 0xD8, 0xFF},
{0xC4, 0xA7, 0xE7, 0xFF},
}
func PrepareCanvas(c *generativeart.Canva) {
c.SetBackground(ROSE_PINE_BASE)
c.FillBackground()
c.SetColorSchema(ROSE_PINE_COLORS)
}
func GenerateCircle(wg *sync.WaitGroup) {
defer wg.Done()
fmt.Println("Generating a circle png...")
c := generativeart.NewCanva(CANVAS_WIDTH, CANVAS_HEIGHT)
PrepareCanvas(c)
c.Draw(arts.NewColorCircle(1234))
c.ToPNG("rose_pine_circle.png")
}
func GenerateCircle2(wg *sync.WaitGroup) {
defer wg.Done()
fmt.Println("Generating a circle2 png...")
c := generativeart.NewCanva(CANVAS_WIDTH, CANVAS_HEIGHT)
PrepareCanvas(c)
c.Draw(arts.NewColorCircle2(333))
c.ToPNG("rose_pine_circle2.png")
}
func GenerateContourLine(wg *sync.WaitGroup) {
defer wg.Done()
fmt.Println("Generating a contourline png...")
c := generativeart.NewCanva(CANVAS_WIDTH, CANVAS_HEIGHT)
PrepareCanvas(c)
c.Draw(arts.NewContourLine(999))
c.ToPNG("rose_pine_contourline.png")
}
func GenerateMaze(wg *sync.WaitGroup) {
defer wg.Done()
fmt.Println("Generating a maze png...")
c := generativeart.NewCanva(CANVAS_WIDTH, CANVAS_HEIGHT)
PrepareCanvas(c)
c.SetLineWidth(1)
for i := range ROSE_PINE_COLORS {
c.SetLineWidth(float64((i+1)/3 + 1))
c.Draw(arts.NewMaze(i*10 + 100))
c.SetLineColor(ROSE_PINE_COLORS[i])
}
c.ToPNG("rose_pine_maze.png")
}
func GenerateNoiseLine(wg *sync.WaitGroup) {
defer wg.Done()
fmt.Println("Generating a noiseline png...")
c := generativeart.NewCanva(CANVAS_WIDTH, CANVAS_HEIGHT)
PrepareCanvas(c)
c.Draw(arts.NewNoiseLine(3456))
c.ToPNG("rose_pine_noiseline.png")
}
func GenerateShape(wg *sync.WaitGroup) {
defer wg.Done()
fmt.Println("Generating a shape png...")
c := generativeart.NewCanva(CANVAS_WIDTH, CANVAS_HEIGHT)
PrepareCanvas(c)
c.Draw(arts.NewRandomShape(111))
c.ToPNG("rose_pine_shape.png")
}
func main() {
rand.Seed(time.Now().Unix())
var wg sync.WaitGroup
wg.Add(1)
go GenerateCircle(&wg)
wg.Add(1)
go GenerateCircle2(&wg)
wg.Add(1)
go GenerateContourLine(&wg)
wg.Add(1)
go GenerateMaze(&wg)
wg.Add(1)
go GenerateNoiseLine(&wg)
wg.Add(1)
go GenerateShape(&wg)
wg.Wait()
fmt.Println("main finished")
}