Skip to content

Commit

Permalink
updating the example
Browse files Browse the repository at this point in the history
the code had been updated since the readme had been made, so time to update the demo code
  • Loading branch information
donuts-are-good authored Apr 3, 2023
1 parent 1ce0424 commit 35d0fca
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,29 @@ To use `colors`, import the package and create an instance of the `Colors` struc
```go
package main

// import the `colors` package
import (
"fmt"

"github.com/donuts-are-good/colors"
)

func main() {
// create a new instance of the "Colors" struct
c := &colors.Colors{}
// create a new instance of Colors
c := colors.Colors{}

// print some colored text
fmt.Println(c.Red + "Hello, world!" + c.Nc)
fmt.Println(c.Green + "Welcome to the world of colors!" + c.Nc)
fmt.Println(c.BrightYellow + "This text is bright yellow!" + c.Nc)

// print the test string "This text is red." in red color using the "Red" color code and reset code "Nc" of the "Colors" struct
fmt.Println(c.Red + "This text is red." + c.Nc)
// reset the colors
c.Reset()

// print some more text
fmt.Println(c.Purple + "Back to normal..." + c.Nc)
}


```
The Colors struct provides a set of color codes that can be used to format text. To color text, simply concatenate the desired color code with the text, and then concatenate the reset code c.Nc to reset the color.

Expand Down Expand Up @@ -58,4 +67,4 @@ Each color is available in both normal and bright variations.
If you find a bug or have a feature request, please open an issue on GitHub. Pull requests are also welcome.

## License
`colors` is licensed under the MIT license. See the LICENSE file for more information.
`colors` is licensed under the MIT license. See the LICENSE file for more information.

0 comments on commit 35d0fca

Please sign in to comment.