diff --git a/Variables.go b/Variables.go index dfbb64b..c2ae173 100644 --- a/Variables.go +++ b/Variables.go @@ -1,8 +1,6 @@ package ps -import ( - "fmt" -) +import "fmt" // ModeEnum determines how aggressively the package will attempt to sync with Photoshop. // Loading Photoshop files from scratch takes a long time, so the package saves diff --git a/colors/colors.go b/colors.go similarity index 86% rename from colors/colors.go rename to colors.go index acc7dd3..19f1a6a 100644 --- a/colors/colors.go +++ b/colors.go @@ -1,22 +1,13 @@ -package colors +package ps -import ( - "encoding/hex" - // "fmt" +import "encoding/hex" + +var ( + ColorBlack Color = RGB{0, 0, 0} + ColorGray Color = RGB{128, 128, 128} + ColorWhite Color = RGB{255, 255, 255} ) -func Black() Color { - return &RGB{0, 0, 0} -} - -func Gray() Color { - return &RGB{128, 128, 128} -} - -func White() Color { - return &RGB{255, 255, 255} -} - // Color is an interface for color objects, allowing colors to be // used in various formats. // diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..de251c1 --- /dev/null +++ b/go.mod @@ -0,0 +1 @@ +module github.com/sbrow/ps diff --git a/ps.go b/ps.go index c39854d..0b3db1e 100644 --- a/ps.go +++ b/ps.go @@ -16,7 +16,6 @@ import ( "path/filepath" "runtime" "strings" - // "update" ) // The name of the program that runs scripts on this OS. diff --git a/sha b/sha new file mode 100644 index 0000000..2bf85ce --- /dev/null +++ b/sha @@ -0,0 +1 @@ +cb37421ea4f7211be99ad4c5710f20155ccc8117 \ No newline at end of file diff --git a/structs.go b/structs.go index 59ee5c8..e9f2db8 100644 --- a/structs.go +++ b/structs.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/sbrow/ps/colors" "io/ioutil" "log" "os" @@ -184,14 +183,14 @@ func (d *Document) Dump() { // // TODO: (2) Make TextLayer a subclass of ArtLayer. type ArtLayer struct { - name string // The layer's name. - bounds [2][2]int // The corners of the layer's bounding box. - parent Group // The LayerSet/Document this layer is in. - visible bool // Whether or not the layer is visible. - current bool // Whether we've checked this layer since we loaded from disk. - colors.Color // The layer's color overlay effect (if any). - *colors.Stroke // The layer's stroke effect (if any). - *TextItem // The layer's text, if it's a text layer. + name string // The layer's name. + bounds [2][2]int // The corners of the layer's bounding box. + parent Group // The LayerSet/Document this layer is in. + visible bool // Whether or not the layer is visible. + current bool // Whether we've checked this layer since we loaded from disk. + Color // The layer's color overlay effect (if any). + *Stroke // The layer's stroke effect (if any). + *TextItem // The layer's text, if it's a text layer. } // Bounds returns the coordinates of the corners of the ArtLayer's bounding box. @@ -233,8 +232,8 @@ func (a *ArtLayer) UnmarshalJSON(b []byte) error { } a.name = tmp.Name a.bounds = tmp.Bounds - a.Color = colors.RGB{tmp.Color[0], tmp.Color[1], tmp.Color[2]} - a.Stroke = &colors.Stroke{tmp.StrokeAmt, colors.RGB{tmp.Stroke[0], tmp.Stroke[1], tmp.Stroke[2]}} + a.Color = RGB{tmp.Color[0], tmp.Color[1], tmp.Color[2]} + a.Stroke = &Stroke{tmp.StrokeAmt, RGB{tmp.Stroke[0], tmp.Stroke[1], tmp.Stroke[2]}} a.visible = tmp.Visible a.current = false a.TextItem = tmp.TextItem @@ -285,7 +284,7 @@ func (a *ArtLayer) SetActive() ([]byte, error) { } // SetColor creates a color overlay for the layer -func (a *ArtLayer) SetColor(c colors.Color) { +func (a *ArtLayer) SetColor(c Color) { if a.Color.RGB() == c.RGB() { if Mode == 2 || (Mode == 0 && a.current) { // log.Println("Skipping color: already set.") @@ -319,7 +318,7 @@ func (a *ArtLayer) SetColor(c colors.Color) { } } -func (a *ArtLayer) SetStroke(stk colors.Stroke, fill colors.Color) { +func (a *ArtLayer) SetStroke(stk Stroke, fill Color) { if stk.Size == 0 { a.Stroke = &stk a.SetColor(fill)