51 Replies
You want to change the same text's colour? Or print a new thing in a different colour every second?
same texts color
For the timing part,
PeriodicTimer
is probably the way to go
For changing colour, Console.ForegroundColor
To replace the text, you'd need to delete the current text and write the new text, or overwrite the old text
Look into setting the position of the cursorproblem is i have other code running which does this lemme just show u
And the issue is...?
With my solution, that is
it would make me reposition the cursor and then make me type where i want to change the color lol
Ah, you want the text that user enters to change colour?
nono i want the logo lizthux to be color changing
rainbow
Ah, huh
It'll require hooking a little deeper into the console, then
Probably
Look into existing libraries like Spectre.Console
Maybe they'll be helpful
Would it be transferrable across machines without downloading stuff on their machine?
Of course
When you publish a project, all the dependencies are compiled with it
ah i thought it was like a custom terminal you had to download
and replace cmd prompt terminal with it
not a c# library
No, it's just a C# library that makes it a bit easier to work with console
alrighty how would i import it
https://spectreconsole.net/quick-start As described in the documentation
Or if you use Visual Studio (not Code) you can just open the package manager UI
And search for
spectre.console
where do i find package manager ui lmao
ahh
i got it
so how could i do the rainbow text?
Check the documentation of Spectre.Console
The
Live
thing should be of help@Angius
how would i do this lol
.Live()
takes a Widget
So you'd use one of the Spectre.Console widgets
Rows
for examplewhich should i use for my purpose
rows doesnt work
You'll want something like this
This will swap between colors every second.
I don't know how well this works with writing to the console simultaneously, though
The error gives you a suggestion for what to do
This will change the text in the entire console
We need to update only a part of it
Ah I see.
await
can only be used inside of async
methodsDoes the text change at all, or just the color?
ok so whats going on is
Just the colour
its printing uwu twice and moving the place i type to where the top uwu is (the top uwu is the only one color changing)
Am I missing code that's been provided?
You might need to use Spectre.Console's inputs
Alright how do i do that
async void
š
Don't do async void
plz
async Task
then i can't thread it
š
https://spectreconsole.net/prompts/text The documentation, of course
Don't use
Thread
alr how do i call the task then
@thinker227
@kaos I've sent you a DM. Feel free to check it whenever and I'll try and help as well.
I think
Task.Run(() => Yeh());
should workWas this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.