From 344c8d43be200ac2e8f9e785322bc9796dcac69c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 21 Sep 2020 06:59:23 +0200 Subject: [PATCH] Impruve docs (#7) * Add Usage Example (close #4) * Add Contribute Note (close #5) * add godocs docu --- README.md | 23 +++++++++++++++++++++++ doc.go | 33 +++++++++++++++++++++++++++++++++ hexcolor.go | 4 ++++ hexcolor_test.go | 4 ++++ 4 files changed, 64 insertions(+) create mode 100644 doc.go diff --git a/README.md b/README.md index 50c5ab3..e1f8f50 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,26 @@ ## ToDo * [ ] Predefine standard colors (red, blue, ... based on CSS colors) + +## Usage + +Download: `go get -u github.com/6543/go-hexcolor` + +Example: +```go +import ( + "fmt" + "github.com/6543/go-hexcolor" +) + +func main() { + c, err := hexcolor.NewHexColor("#adf") + if err != nil { + panic(err) + } + fmt.Println(c.ToString()) +} +``` + +## Contribution +Fork repository, clone it, make changes, push to new branch and submit a pull request. diff --git a/doc.go b/doc.go new file mode 100644 index 0000000..9cb3b36 --- /dev/null +++ b/doc.go @@ -0,0 +1,33 @@ +// Copyright 2020 6543. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + +Package hexcolor is a simple hexcolor normalizer + +Installation + + go get -u github.com/6543/go-hexcolor + +Example + + ```go + package main + + import ( + "fmt" + "github.com/6543/go-hexcolor" + ) + + func main() { + c, err := hexcolor.NewHexColor("#adf") + if err != nil { + panic(err) + } + fmt.Println(c.ToString()) + } + ``` + +*/ +package hexcolor diff --git a/hexcolor.go b/hexcolor.go index da0ca6e..c9bcb58 100644 --- a/hexcolor.go +++ b/hexcolor.go @@ -1,3 +1,7 @@ +// Copyright 2020 6543. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package hexcolor import ( diff --git a/hexcolor_test.go b/hexcolor_test.go index 0f2f198..f1ba55e 100644 --- a/hexcolor_test.go +++ b/hexcolor_test.go @@ -1,3 +1,7 @@ +// Copyright 2020 6543. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package hexcolor import (