Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Example for getting custom colors #21

Closed
vzamanillo opened this issue Sep 5, 2020 · 2 comments
Closed

Question: Example for getting custom colors #21

vzamanillo opened this issue Sep 5, 2020 · 2 comments

Comments

@vzamanillo
Copy link
Contributor

Hey, thank you for this awesome package.

I am looking for examples of how to use custom colors that are not predefined in aurora, (orange, turquoise, etc...), could you please provide some example?.

Thanks!

@logrusorgru
Copy link
Owner

Hello.

May be Index and BgIndex is what you need. Also, check out README/8 bit colors paragraph.

But, the indices can't be used with Colorize method. Since, colors and indices are different. Actually, you can convert between Colors and indices using simple formulas. But underlying colors representations is not specified and can be changed in future versions.

For example

package main

import (
	"fmt"
	"github.com/logrusorgru/aurora"
)

func main() {
	for i := uint8(16); i <= 231; i++ {
		fmt.Println(i, aurora.Index(i, "pew-pew"), aurora.BgIndex(i, "pew-pew"))
	}
}

@vzamanillo
Copy link
Contributor Author

Thank you very much for your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants