0

[CLEARIFIED] Change Text Color in Code Playground using Python

How can I change the text color in Code Playground using Python. I try to write a code but it won't work. In my code I try to create an image with the desired text and color using PIL, then convert the image pixels to ANSI color codes to display it in the playground terminal. But it shows error because of fonts. 𝘐𝘴 𝘵𝘩𝘦𝘳𝘦 𝘢𝘯𝘺 𝘸𝘢𝘺 𝘐 𝘤𝘢𝘯 𝘤𝘩𝘢𝘯𝘨𝘦 𝘵𝘩𝘦 𝘧𝘰𝘯𝘵 𝘤𝘰𝘭𝘰𝘳 𝘪𝘯 𝘊𝘰𝘥𝘦 𝘗𝘭𝘢𝘺𝘨𝘳𝘰𝘶𝘯𝘥 𝘪𝘯 𝘚𝘰𝘭𝘰𝘭𝘦𝘢𝘳𝘯 𝘸𝘪𝘵𝘩 𝘧𝘪𝘹𝘪𝘯𝘨 𝘮𝘺 𝘤𝘰𝘥𝘦 𝘰𝘳 𝘪𝘴 𝘵𝘩𝘦𝘳𝘦 𝘢𝘯𝘺 𝘢𝘭𝘵𝘦𝘳𝘯𝘢𝘵𝘪𝘷𝘦 𝘸𝘢𝘺 𝘵𝘰 𝘥𝘰 𝘵𝘩𝘪𝘴 𝘪𝘯 𝘗𝘺𝘵𝘩𝘰𝘯? 𝘛𝘩𝘢𝘯𝘬𝘴 𝘪𝘯 𝘢𝘥𝘷𝘢𝘯𝘤𝘦! https://sololearn.com/compiler-playground/cdo6Kv477CH9/?ref=app

13th Apr 2024, 11:31 AM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar
5 odpowiedzi
+ 2
I don't believe it's possible with the Sololearn compiler. I know that Oma Falk has done some kind of graphics with the Python compiler. You could check those codes out, see if that's in the right direction.
13th Apr 2024, 2:28 PM
Ausgrindtube
Ausgrindtube - avatar
+ 2
нттp⁴⁰⁶ , I've seen a few programs by other people on Sololearn that use a trick that only works on Sololearn to execute some HTML in Python by putting it in a str literal. It fails if you copy it to an external IDE, where it just prints the str literal instead of executing it. I haven't saved links to all of them. Here's one that I did save the link to. It doesn't change the font color, but it does change the background color. You can fiddle with it to try adding the HTML you want. https://sololearn.com/compiler-playground/cK6u3JGHnEqo/?ref=app
13th Apr 2024, 4:33 PM
Rain
Rain - avatar
+ 2
нттp⁴⁰⁶ OK. I found one with red text by David Ashton. (Again, it doesn't work outside of Sololearn.) https://sololearn.com/compiler-playground/cdtdvNxleozG/?ref=app
13th Apr 2024, 4:48 PM
Rain
Rain - avatar
+ 2
Thank Rain
13th Apr 2024, 5:08 PM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar
+ 1
Ausgrindtube Thank you sir. Let me check 😊
13th Apr 2024, 2:41 PM
`ᴴᵗᵗየ
`ᴴᵗᵗየ - avatar