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

feat: Function to set the printer features #14

Open
chr45 opened this issue Jan 6, 2023 · 0 comments
Open

feat: Function to set the printer features #14

chr45 opened this issue Jan 6, 2023 · 0 comments

Comments

@chr45
Copy link

chr45 commented Jan 6, 2023

Describe the feature request

You could add a function for Custom coloring

Example:

func CustomColoring(foreground string, background string, s any, bold bool, underline bool) string {
	b, u := "", ""
	if bold {
		b = Bold
	}
	if underline {
		u = Underline
	}
	return Colorize(b+u+foreground+background, s)
}

Usage:

log.Println(color.CustomColoring(color.White, color.Black, s, false, false))
log.Println(color.CustomColoring(color.White, color.Black, s, true, false))
log.Println(color.CustomColoring(color.White, color.Black, s, false, true))
log.Println(color.CustomColoring(color.Black, color.White, s, true, true))

or

func CustomColoring(foreground string, background string, s any, bold string, underline string) string {
	return Colorize(bold+underline+foreground+background, s)
}

Usage:

log.Println(color.CustomColoring(color.White, color.Black, s, "", ""))
log.Println(color.CustomColoring(color.White, color.Black, s, color.Bold, ""))
log.Println(color.CustomColoring(color.White, color.Black, s, "", color.Underline))
log.Println(color.CustomColoring(color.Black, color.White, s, color.Bold, color.Underline))

Result:

Screenshot from 2023-01-06 14-14-16

Why do you personally want this feature to be implemented?

I already implemented

How long have you been using this project?

one year

Additional information

No 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

1 participant