Are other fonts available in the App Lab?
Great question, I never thought about doing that before, but I will get an answer for you!
There’s no way to set the font in design mode, but we do have an advanced undocumented command called
setStyle that allows you to assign a CSS style to your design mode elements (great callback to unit 2!).
setStyle takes two parameters, the first is an ID of an element, and the second a string of CSS to apply to that element, for example:
setStyle("myButton", "font-family: cursive; font-weight: bold;");
Here’s a quick example app showing how
setStyle works https://studio.code.org/projects/applab/YzXR4wJXjGfrUSuFp9qzYA/edit
Since I was playing around with this anyway, and it may be of more interest to students in CSD who have already learned some CSS, I put up a quick documentation page for
Thanks! I will play around with it today.
Where exactly do we put the CSS setStyle code? In the workspace window with the onEvents?
Nevermind - I realized the change in font doesn’t take effect until the app is running.
Thanks so much! I love this!
Fabulous update. Great callback indeed. Thank you!