Backgrounds and overlays (Possibly animated too?) #478
Unanswered
StephanieSunshine
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hi @StephanieSunshine, your timing is really lucky! We just finished the proposal to support background colors for RGB: #473. So you will be able to print text on top of a background color. This also works with fading background colors. Sadly, this is not yet released, because we found a bug where the fading might be a little wrong. This will be fixed today or tomorrow. I'll write again when the new version is released. Little hint: I would extract the terminal sizes into a variable, getting those in a loop is very slow (for each call a syscall is made to get the terminal size). This is much faster: termHeight := pterm.GetTerminalHeight()
termWidth := pterm.GetTerminalWidth()
// For loop over the range of the terminal height.
for h := 0; h < termHeight; h++ {
for w := 0; w < termWidth; w++ {
// Print string which is colored with the faded RGB value.
from.Fade(0, float32(termWidth*termHeight), float32(h*w), to, to2, to3, to4).Print("█")
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, after looking at the various demos I decided to hack something as a test to see if I could make a TUI with a colorful background, maybe even animated. I figured out how to create a vivid background using the truecolor examples:
However, every time I try to add another example I'm watching the window scroll. Example sourced from another example about bigtext:
Is it possible to overlay text / input over the first background paint without having it scroll? Would it some how be possible to animate the fade?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions