Theming and scopes #6231
Replies: 1 comment
-
Posted at 2023-09-20 by @gfwilliams
Well, Graphics state is always global - you should always get in the habit of calling If you just do The current solution is just a sensible compromise of complexity and memory usage... I guess potentially we could have a way to 'clone' a graphics instance into a variable where state for that var is kept separately - but I think the end result is it'd end up getting used pretty lazily and we'd end up storing loads of different graphics states for things that really didn't need it. Posted at 2023-09-21 by charlie I agree that actually implementing it in practice would be difficult. I can actually do this with typescript using transformers by using custom decorators at the top of methods (eg @themed({themeOptions}. Which could inject lines at the top of method to set theme options and lines at the bottom to reset when compiling. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2023-09-20 by charlie
I have noticed that if I initiate a menu, once returning to my normal screen render, text is offset slightly on the y axis. I assume this is due to the menu setting up some font settings.
Is theming always global?
If it is, has there been any discussion about making it scope specific? So if you have a function and you set the forecolour or font etc within that function, anything rendered to screen from that scope (the function and sub functions) uses that theming.
This seems like a sensible approach to me as as I build up my app and have "renderSomeThing" type methods, if I have scope specific colouring I either have to make sure every single render method sets the theme, which makes it hard to make compiler safe code. Or every method which changes something needs to call a theme reset at the end.
Beta Was this translation helpful? Give feedback.
All reactions