-
Notifications
You must be signed in to change notification settings - Fork 64
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
Make possible to define styles as CSS #1
Comments
I had been thinking of making a compiler that would convert CSS to LittlevGL 7 styles. How does Rust integrate with CSS? Perhaps we can combine our efforts. |
Hey! I'm thrilled to hear about your interest in I think the compiler you're mentioning is a great idea. It will definitely make it easier to write Lvgl styles. This is similar in theory to the idea I describe in this issue, but in Rust it would work differently. Rust doesn't integrate with CSS. I want to write a Rust macro that accepts content looking like CSS and which, at compile time, will convert the pseudo-CSS content to actual Rust code calling the public methods in the I think we could work together on enabling your compiler to generate the Rust macro or generate the final Additionally, I would love to share the knowledge of the transformations like which CSS property means what in Lvgl. |
I fiddled with it for a few hours today and got a rudimentary proof-of-concept working. I also uploaded my code here. At the moment, it can take a CSS file with classname selectors and translate it to a C file containing LVGL It seems to me that your Rust macro could translate the pseudo-CSS to a real CSS file which then gets run through my compiler. My compiler could then output |
Wow, nice! I will have a look at your code. I don't know how familiar you are with Rust language, but Rust macros are preprocessed internally by the Rust compiler. So it is not a very good idea to save the pseudo-CSS into a file and call an external tool for preprocessing. I think it was not clear in my previous comment and I'm sorry about that. What I meant is for your compiler to generate either of these (based on a user option):
I know the second option might sound redundant, but I thought users could learn that the Those two options are different public APIs that I would be happy to help by sending a PR to add those options to your compiler. Plus I can be the main point of contact/maintainer of those two options related to |
Sounds good to me. I'm not particularly familiar with how Rust works (more of a C and JS person) so do whatever you think is best. 🙂 |
Cool, I will make sure |
Would be nice to be able to define styles in CSS format. That makes it easy to prototype and convert to LittlevGL Rust implementation.
Besides the possibility of creating styles like in C code:
We would like to be also able to use CSS:
Both examples here would be equivalent Rust code after compilation.
The text was updated successfully, but these errors were encountered: