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

Is a css reset kind of behaviour possible? #23

Open
axelderoeck opened this issue Feb 6, 2024 · 3 comments
Open

Is a css reset kind of behaviour possible? #23

axelderoeck opened this issue Feb 6, 2024 · 3 comments

Comments

@axelderoeck
Copy link

I was wondering since the components have a default style applied to them if it is possible to have a css reset sort of like option?

This way we can apply styles to a component starting from nothing.

My current solution is a css reset object:

export const CSS_RESET = {
  "background-color": "white", // Preferably default transparent background but I don't know if its possible in lvgljs.
  "height": "auto",
  "width": "auto",
  "border-width": 0, 
  "border-radius": 0,
  "padding": 0,
  "padding-left": 0,
  "padding-right": 0,
  "padding-top": 0,
  "padding-bottom": 0,
  "shadow-width": 0,
  "shadow-offset-x": 0,
  "shadow-offset-y": 0,
  "outline-width": 0,
  "outline-padding": 0,
  "column-spacing": 0,
  "row-spacing": 0
}

And then add the object to every style:

<View
  style={{
    ...CSS_RESET,
    "height": "300px",
    ...
  }}
>
...
</View>

It would be nice to avoid having to re-use this object everywhere.

@kisvegabor
Copy link
Member

You can call lv_obj_remove_style_all() to remove all the styles from a widget.

@axelderoeck
Copy link
Author

I can't seem to find this function in the lv_binding_js project. How and where would I use this?

@kisvegabor
Copy link
Member

I can comment only on the C LVGL. 🙁
cc @derekstavis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants