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

🖊️ Color in print #5836

Open
Felienne opened this issue Oct 4, 2024 · 4 comments
Open

🖊️ Color in print #5836

Felienne opened this issue Oct 4, 2024 · 4 comments
Labels
language Issues related to the Hedy language

Comments

@Felienne
Copy link
Member

Felienne commented Oct 4, 2024

Idea from a student, can we also have colors in the output? I guess disconnected from Python/Skulpt we can do that with realitive ease?

@Felienne Felienne added the language Issues related to the Hedy language label Oct 4, 2024
@jpelay
Copy link
Member

jpelay commented Oct 4, 2024

Yes, we totally can, the function that prints to the output is controlled by us, so its just a matter of setting the color. The complicated part would to ideate a way to communicate with this function from Python, but we already call a bit of JavaScript from Python

hedy/static/js/app.ts

Lines 1166 to 1176 in e8460ef

function addToOutput(text: string, color: string) {
$('<span>').text(text).css({ color }).appendTo(outputDiv);
scrollOutputToBottom();
}
// output functions are configurable. This one just appends some text
// to a pre element.
function outf(text: string) {
addToOutput(text, 'white');
speak(text)
}

@jpelay
Copy link
Member

jpelay commented Oct 4, 2024

Do you have a command in mind or maybe make the color customizable within the UI?

@Felienne
Copy link
Member Author

Felienne commented Oct 5, 2024

I think the kids expectation was that:

color blue
print Hello!

Would print Hello! in blue which I think is a reasonable expectation?

So it was not so much an idea of a kids as a misconception, haha!

@jpelay
Copy link
Member

jpelay commented Oct 7, 2024

color blue
print Hello!

I think that makes sense! I think a bit of control on the output could be a lot of fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language Issues related to the Hedy language
Projects
Status: No status
Development

No branches or pull requests

2 participants