Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TwiN/go-color
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.0
Choose a base ref
...
head repository: TwiN/go-color
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.0
Choose a head ref
  • 9 commits
  • 9 files changed
  • 2 contributors

Commits on Dec 28, 2021

  1. Add missing example

    TwiN committed Dec 28, 2021
    Copy the full SHA
    03ee3b7 View commit details

Commits on Jan 30, 2022

  1. chore: Bump license year to 2022

    TwiN committed Jan 30, 2022
    Copy the full SHA
    138f541 View commit details

Commits on Apr 22, 2022

  1. chore: Update Go to 1.18

    TwiN committed Apr 22, 2022
    Copy the full SHA
    6415285 View commit details

Commits on Jun 18, 2022

  1. Copy the full SHA
    788dd7b View commit details
  2. docs: Fix typo in badge

    TwiN committed Jun 18, 2022
    Copy the full SHA
    9185dd3 View commit details

Commits on Jul 28, 2022

  1. Copy the full SHA
    ebc4ed4 View commit details

Commits on Aug 25, 2022

  1. chore: Update Go to 1.19

    TwiN committed Aug 25, 2022
    Copy the full SHA
    a995dc9 View commit details

Commits on Sep 24, 2022

  1. docs: Fix typo

    TwiN authored Sep 24, 2022
    Copy the full SHA
    d4362db View commit details

Commits on Oct 11, 2022

  1. feat: Add Black and Underline

    TwiN committed Oct 11, 2022
    Copy the full SHA
    0239897 View commit details
Showing with 128 additions and 250 deletions.
  1. +0 −24 .github/workflows/build.yml
  2. +21 −0 .github/workflows/test.yml
  3. +21 −0 LICENSE
  4. +0 −201 LICENSE.md
  5. +10 −3 README.md
  6. +52 −21 color.go
  7. +21 −0 color_test.go
  8. +2 −0 color_windows.go
  9. +1 −1 go.mod
24 changes: 0 additions & 24 deletions .github/workflows/build.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: test
on:
pull_request:
paths-ignore:
- '*.md'
push:
branches:
- master
paths-ignore:
- '*.md'
jobs:
test:
name: test
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.19
- uses: actions/checkout@v3
- run: go test -mod vendor ./...
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 TwiN

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
201 changes: 0 additions & 201 deletions LICENSE.md

This file was deleted.

13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# go-color

![build](https://github.com/TwiN/go-color/workflows/build/badge.svg?branch=master)
![test](https://github.com/TwiN/go-color/workflows/test/badge.svg?branch=master)

An extremely lightweight cross-platform package to colorize text in terminals.

@@ -29,8 +29,10 @@ import "github.com/TwiN/go-color"

func main() {
println(color.Ize(color.Red, "This is red"))
// Or if you prefer the longer version
// Or if you prefer the longer version:
println(color.Colorize(color.Red, "This is red"))
// Or if you prefer the non-parameterized version:
println(color.InRed("This is red"))
}
```

@@ -50,6 +52,8 @@ import "github.com/TwiN/go-color"

func main() {
println(color.InBold("This is bold"))
println(color.InUnderline("This is underlined"))
println(color.InBlack("This is black"))
println(color.InRed("This is red"))
println(color.InGreen("This is green"))
println(color.InYellow("This is yellow"))
@@ -64,7 +68,7 @@ func main() {

### Variables only

Unlike using the aforementioned approach, directly using the color variables will required you to manually
Unlike using the aforementioned approach, directly using the color variables will require you to manually
prepend `color.Reset` at the end of your string.

You can either directly use the variables like so:
@@ -75,6 +79,9 @@ package main
import "github.com/TwiN/go-color"

func main() {
println(color.Bold + "This is bold" + color.Reset)
println(color.Underline + "This is underlined" + color.Reset)
println(color.Black + "This is black" + color.Reset)
println(color.Red + "This is red" + color.Reset)
println(color.Green + "This is green" + color.Reset)
println(color.Yellow + "This is yellow" + color.Reset)
Loading